refs #1164 ogRaiseError function call correction

code-review
Antonio Guerrero 2024-11-19 08:55:33 -06:00
parent d061c6116a
commit 6bc47bb157
1 changed files with 15 additions and 3 deletions

View File

@ -38,7 +38,11 @@ def ogAddRegistryValue(path_mountpoint, str_hive, str_key, str_valuename, str_va
elif str_valuetype.upper() == 'DWORD':
TYPE = 4
else:
SystemLib.ogRaiseError(OG_ERR_OUTOFLIMIT, str_valuetype)
SystemLib.ogRaiseError(
"session",
ogGlobals.OG_ERR_OUTOFLIMIT,
f"Error: {str_valuetype}",
)
return
# Add the registry value.
@ -83,7 +87,11 @@ def ogGetHivePath(path_mountpoint, str_hive):
if FILE and os.path.isfile(FILE):
return FILE
else:
SystemLib.ogRaiseError(OG_ERR_NOTFOUND, f"{path_mountpoint} {str_hive}")
SystemLib.ogRaiseError(
"session",
ogGlobals.OG_ERR_NOTFOUND,
f"{path_mountpoint} {str_hive}"
)
return None
def ogGetRegistryValue(path_mountpoint, str_hive, str_valuename):
@ -161,7 +169,11 @@ def ogSetRegistryValue(path_mountpoint, str_hive, str_valuename, str_data):
if f"BINARY.*<{str_valuename.rsplit('\\', 1)[-1]}>" in output:
# Procesar tipo binario (incluir nº de bytes y líneas de 16 parejas hexadecimales).
if not re.match(r'^([0-9A-F]{2} )*$', str_data):
SystemLib.ogRaiseError(OG_ERR_FORMAT, f'"{str_data}"')
SystemLib.ogRaiseError(
"session",
ogGlobals.OG_ERR_FORMAT,
f'"{str_data}"'
)
return
n = len(str_data) + 1
with open(tmpfile, 'w') as f: