mirror of
https://github.com/RoboSats/robosats.git
synced 2025-09-13 00:56:22 +00:00
Update API utils errors
This commit is contained in:
31
api/utils.py
31
api/utils.py
@ -9,6 +9,7 @@ import ring
|
|||||||
from base91 import decode, encode
|
from base91 import decode, encode
|
||||||
from decouple import config
|
from decouple import config
|
||||||
|
|
||||||
|
from api.errors import new_error
|
||||||
from api.models import Order
|
from api.models import Order
|
||||||
|
|
||||||
logger = logging.getLogger("api.utils")
|
logger = logging.getLogger("api.utils")
|
||||||
@ -399,14 +400,13 @@ def validate_pgp_keys(pub_key, enc_priv_key):
|
|||||||
if "Not actually changed" not in import_pub_result.results[0]["text"]:
|
if "Not actually changed" not in import_pub_result.results[0]["text"]:
|
||||||
return (
|
return (
|
||||||
False,
|
False,
|
||||||
{
|
new_error(1034, {
|
||||||
"bad_request": "Your PGP public key does not seem valid.\n"
|
"import_pub_result_stderr": str(import_pub_result.stderr),
|
||||||
+ f"Stderr: {str(import_pub_result.stderr)}\n"
|
"import_pub_result_returncode": str(import_pub_result.returncode),
|
||||||
+ f"ReturnCode: {str(import_pub_result.returncode)}\n"
|
"import_pub_result_summary": str(import_pub_result.summary),
|
||||||
+ f"Summary: {str(import_pub_result.summary)}\n"
|
"import_pub_result_results": str(import_pub_result.results),
|
||||||
+ f"Results: {str(import_pub_result.results)}\n"
|
"import_pub_result_imported": str(import_pub_result.imported)
|
||||||
+ f"Imported: {str(import_pub_result.imported)}\n"
|
}),
|
||||||
},
|
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
@ -419,14 +419,13 @@ def validate_pgp_keys(pub_key, enc_priv_key):
|
|||||||
if "Not actually changed" not in import_priv_result.results[0]["text"]:
|
if "Not actually changed" not in import_priv_result.results[0]["text"]:
|
||||||
return (
|
return (
|
||||||
False,
|
False,
|
||||||
{
|
new_error(1034, {
|
||||||
"bad_request": "Your PGP encrypted private key does not seem valid.\n"
|
"import_priv_result_stderr": str(import_priv_result.stderr),
|
||||||
+ f"Stderr: {str(import_priv_result.stderr)}\n"
|
"import_priv_result_returncode": str(import_priv_result.returncode),
|
||||||
+ f"ReturnCode: {str(import_priv_result.returncode)}\n"
|
"import_priv_result_summary": str(import_priv_result.summary),
|
||||||
+ f"Summary: {str(import_priv_result.summary)}\n"
|
"import_priv_result_results": str(import_priv_result.results),
|
||||||
+ f"Results: {str(import_priv_result.results)}\n"
|
"import_priv_result_imported": str(import_priv_result.imported)
|
||||||
+ f"Sec Imported: {str(import_priv_result.sec_imported)}\n"
|
}),
|
||||||
},
|
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user