Ticket #2273 defect closed fixed
AMP documentation on command errors is reversed or code is
| Reported by: | htj | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Core-2.5 |
| Component: | core | Keywords: | amp |
| Cc: | Branch: | ||
| Author: | Launchpad Bug: |
Description
line 1038 in protocols/amp.py says:
@cvar errors: A mapping of error tag to exception type.
which is wrong because errors have to be mapped like this to work:
errors = {SomeException: 'SOME_ERROR'}
The easy solution is to flip the text in the docstring so it reads:
@cvar errors: A mapping of exceptions types to error tags.
However, I think that what the docstring says is better. By having ERROR_TAG -> Exception, it is possible to map several error tags to the same exception. This is not possible with the current scheme, as an exception maps to an error tag. Hence one exception cannot map to several tags, unless we start using lists, but that just makes it more nasty.
I know this is an API change, but since AMP has not yet been in official release it should be doable.
