Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-19458: FieldValidationError usage incorrect in many tasks #38

Merged
merged 1 commit into from
Apr 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 14 additions & 5 deletions python/lsst/pex/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,17 @@ def __setattr__(cls, name, value):


class FieldValidationError(ValueError):
"""An exception that holds additional information, as attributes,
for debugging `lsst.pex.config.Config` errors.
"""Raised when a ``~lsst.pex.config.Field`` is not valid in a
particular ``~lsst.pex.config.Config``.

Parameters
----------
field : `lsst.pex.config.Field`
The field that was not valid.
config : `lsst.pex.config.Config`
The config containing the invalid field.
msg : `str`
Text describing why the field was not valid.
"""

def __init__(self, field, config, msg):
Expand Down Expand Up @@ -169,11 +178,11 @@ def __init__(self, field, config, msg):

self.configSource = config._source
error = "%s '%s' failed validation: %s\n"\
"For more information read the Field definition at:\n%s"\
"And the Config definition at:\n%s" % \
"For more information see the Field definition at:\n%s"\
" and the Config definition at:\n%s" % \
(self.fieldType.__name__, self.fullname, msg,
self.fieldSource.format(), self.configSource.format())
ValueError.__init__(self, error)
super().__init__(error)


class Field:
Expand Down