forked from ga4gh/ga4gh-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert_error_code.py
More file actions
33 lines (25 loc) · 857 Bytes
/
convert_error_code.py
File metadata and controls
33 lines (25 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
Simple script to decode exception error codes. This translates
the error code received by clients into an exception class.
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import ga4gh.server.exceptions as exceptions
def parseArgs():
parser = argparse.ArgumentParser(
description=(
"Converts an error code received by a clients to the "
"corresponding exception class."))
parser.add_argument(
"errorCode", type=int,
help="The errorCode value in a GAException object.")
args = parser.parse_args()
return args
def main():
args = parseArgs()
exceptionClass = exceptions.getExceptionClass(args.errorCode)
print(args.errorCode, exceptionClass, sep="\t")
if __name__ == '__main__':
main()