Skip to content
Snippets Groups Projects

changed error code for access to deleted post

Merged Andrzej Lisak requested to merge deleted_post_code_fix into develop
2 files
+ 5
2
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -16,6 +16,9 @@ class ApiError(Exception):
@@ -16,6 +16,9 @@ class ApiError(Exception):
# pylint: disable=unnecessary-pass
# pylint: disable=unnecessary-pass
pass
pass
 
# values -32768..-32000 are reserved
 
ACCESS_TO_DELETED_POST_ERROR_CODE = -31999
 
def return_error_info(function):
def return_error_info(function):
"""Async API method decorator which catches and formats exceptions."""
"""Async API method decorator which catches and formats exceptions."""
@wraps(function)
@wraps(function)
@@ -26,7 +29,7 @@ def return_error_info(function):
@@ -26,7 +29,7 @@ def return_error_info(function):
except (RaiseException) as e:
except (RaiseException) as e:
msg = e.diag.message_primary
msg = e.diag.message_primary
if 'was deleted' in msg:
if 'was deleted' in msg:
raise RPCApiError('Invalid parameters',-32199,msg) # deleted post
raise RPCApiError('Invalid parameters', ACCESS_TO_DELETED_POST_ERROR_CODE, msg)
else:
else:
raise AssertionError(msg)
raise AssertionError(msg)
except (ApiError, AssertionError, TypeError, Exception) as e:
except (ApiError, AssertionError, TypeError, Exception) as e:
Loading