-
Notifications
You must be signed in to change notification settings - Fork 79
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
Error response wrapping #238
Changes from all commits
84042ac
25441a6
89ff4fe
dfd602b
becc6e1
7eba11f
2fa5973
f61f704
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,11 +49,14 @@ def fmt_obj(o): | |
return json.dumps(o, indent=2) | ||
|
||
|
||
def fmt_error_type(data_type): | ||
def fmt_error_type(data_type, wrap_error_in=''): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Can't we just default this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We do need to default to '' becuase that is what comes in if the flag isn't set, so this would have to be checked when we call it and I think its better to abstract that here |
||
""" | ||
Converts the error type into a JSDoc type. | ||
""" | ||
return 'Error.<%s>' % fmt_type(data_type) | ||
return '%s.<%s>' % ( | ||
(wrap_error_in if (wrap_error_in != '') else 'Error'), | ||
fmt_type(data_type) | ||
) | ||
|
||
|
||
def fmt_type_name(data_type): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,13 +41,16 @@ | |
} | ||
|
||
|
||
def fmt_error_type(data_type, inside_namespace=None): | ||
def fmt_error_type(data_type, inside_namespace=None, wrap_error_in=''): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Same here - just default to |
||
""" | ||
Converts the error type into a TypeScript type. | ||
inside_namespace should be set to the namespace that the reference | ||
occurs in, or None if this parameter is not relevant. | ||
""" | ||
return 'Error<%s>' % fmt_type(data_type, inside_namespace) | ||
return '%s<%s>' % ( | ||
(wrap_error_in if (wrap_error_in != '') else 'Error'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Same here - and then update to only |
||
fmt_type(data_type, inside_namespace) | ||
) | ||
|
||
def fmt_type_name(data_type, inside_namespace=None): | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Remove extra line