Merge pull request #15472 from s-hadinger/berry_load_logging

Berry improve logging when using `load()`
This commit is contained in:
s-hadinger 2022-04-27 09:51:30 +02:00 committed by GitHub
commit 5a03fbaa92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 24 deletions

View File

@ -21,7 +21,7 @@ extern const bcstring be_const_str_BRY_X3A_X20argument_X20must_X20be_X20a_X20fun
extern const bcstring be_const_str_BRY_X3A_X20bytecode_X20has_X20wrong_X20version_X20_X27_X25s_X27_X20_X28_X25i_X29;
extern const bcstring be_const_str_BRY_X3A_X20corrupt_X20bytecode_X20_X27_X25s_X27;
extern const bcstring be_const_str_BRY_X3A_X20could_X20not_X20save_X20compiled_X20file_X20_X25s_X20_X28_X25s_X29;
extern const bcstring be_const_str_BRY_X3A_X20failed_X20to_X20load_X20_X27_X25s_X27_X20_X28_X25s_X29;
extern const bcstring be_const_str_BRY_X3A_X20failed_X20to_X20load_X20_X27_X25s_X27_X20_X28_X25s_X20_X2D_X20_X25s_X29;
extern const bcstring be_const_str_BRY_X3A_X20failed_X20to_X20load_X20_persist_X2Ejson;
extern const bcstring be_const_str_BRY_X3A_X20failed_X20to_X20load_X20compiled_X20_X27_X25s_X27_X20_X28_X25s_X29;
extern const bcstring be_const_str_BRY_X3A_X20failed_X20to_X20run_X20compiled_X20code_X20_X27_X25s_X27_X20_X2D_X20_X25s;

View File

@ -95,7 +95,7 @@ be_define_const_str(BRY_X3A_X20argument_X20must_X20be_X20a_X20function, "BRY: ar
be_define_const_str(BRY_X3A_X20bytecode_X20has_X20wrong_X20version_X20_X27_X25s_X27_X20_X28_X25i_X29, "BRY: bytecode has wrong version '%s' (%i)", 2140321415u, 0, 41, &be_const_str_clock);
be_define_const_str(BRY_X3A_X20corrupt_X20bytecode_X20_X27_X25s_X27, "BRY: corrupt bytecode '%s'", 4009923544u, 0, 26, &be_const_str_codedump);
be_define_const_str(BRY_X3A_X20could_X20not_X20save_X20compiled_X20file_X20_X25s_X20_X28_X25s_X29, "BRY: could not save compiled file %s (%s)", 736659787u, 0, 41, &be_const_str_clock_icon);
be_define_const_str(BRY_X3A_X20failed_X20to_X20load_X20_X27_X25s_X27_X20_X28_X25s_X29, "BRY: failed to load '%s' (%s)", 54995609u, 0, 29, &be_const_str__rules);
be_define_const_str(BRY_X3A_X20failed_X20to_X20load_X20_X27_X25s_X27_X20_X28_X25s_X20_X2D_X20_X25s_X29, "BRY: failed to load '%s' (%s - %s)", 1047433014u, 0, 34, &be_const_str_couldn_X27t_X20not_X20initialize_X20noepixelbus);
be_define_const_str(BRY_X3A_X20failed_X20to_X20load_X20_persist_X2Ejson, "BRY: failed to load _persist.json", 2991913445u, 0, 33, &be_const_str__global_def);
be_define_const_str(BRY_X3A_X20failed_X20to_X20load_X20compiled_X20_X27_X25s_X27_X20_X28_X25s_X29, "BRY: failed to load compiled '%s' (%s)", 3488122666u, 0, 38, &be_const_str_connection_error);
be_define_const_str(BRY_X3A_X20failed_X20to_X20run_X20compiled_X20code_X20_X27_X25s_X27_X20_X2D_X20_X25s, "BRY: failed to run compiled code '%s' - %s", 380265962u, 0, 42, &be_const_str_gpio);
@ -1109,8 +1109,8 @@ static const bstring* const m_string_table[] = {
(const bstring *)&be_const_str_coord_arr,
(const bstring *)&be_const_str_CFG_X3A_X20multiple_X20autoconf_X20files_X20found_X2C_X20aborting_X20_X28_X27_X25s_X27_X20_X2B_X20_X27_X25s_X27_X29,
(const bstring *)&be_const_str_line_dsc,
(const bstring *)&be_const_str_BRY_X3A_X20failed_X20to_X20load_X20_X27_X25s_X27_X20_X28_X25s_X29,
(const bstring *)&be_const_str_couldn_X27t_X20not_X20initialize_X20noepixelbus,
(const bstring *)&be_const_str__rules,
(const bstring *)&be_const_str_BRY_X3A_X20failed_X20to_X20load_X20_X27_X25s_X27_X20_X28_X25s_X20_X2D_X20_X25s_X29,
(const bstring *)&be_const_str__X3A,
NULL,
(const bstring *)&be_const_str_CFG_X3A_X20loading_X20_X27_X25s_X27,

View File

@ -1365,7 +1365,7 @@ be_local_closure(Tasmota_load, /* name */
})
),
be_nested_proto(
9, /* nstack */
11, /* nstack */
1, /* argc */
0, /* varg */
0, /* has upvals */
@ -1377,11 +1377,11 @@ be_local_closure(Tasmota_load, /* name */
/* K0 */ be_nested_str(file),
/* K1 */ be_nested_str(string),
/* K2 */ be_nested_str(format),
/* K3 */ be_nested_str(BRY_X3A_X20failed_X20to_X20load_X20_X27_X25s_X27_X20_X28_X25s_X29),
/* K3 */ be_nested_str(BRY_X3A_X20failed_X20to_X20load_X20_X27_X25s_X27_X20_X28_X25s_X20_X2D_X20_X25s_X29),
}),
&be_const_str_try_compile,
&be_const_str_solidified,
( &(const binstruction[23]) { /* code */
( &(const binstruction[24]) { /* code */
0xA8020007, // 0000 EXBLK 0 #0009
0x6004000D, // 0001 GETGBL R1 G13
0x5C080000, // 0002 MOVE R2 R0
@ -1390,21 +1390,22 @@ be_local_closure(Tasmota_load, /* name */
0xA8040001, // 0005 EXBLK 1 1
0x80040200, // 0006 RET 1 R1
0xA8040001, // 0007 EXBLK 1 1
0x7002000B, // 0008 JMP #0015
0xAC040001, // 0009 CATCH R1 0 1
0x70020008, // 000A JMP #0014
0xA40A0200, // 000B IMPORT R2 K1
0x600C0001, // 000C GETGBL R3 G1
0x8C100502, // 000D GETMET R4 R2 K2
0x58180003, // 000E LDCONST R6 K3
0x5C1C0000, // 000F MOVE R7 R0
0x5C200200, // 0010 MOVE R8 R1
0x7C100800, // 0011 CALL R4 4
0x7C0C0200, // 0012 CALL R3 1
0x70020000, // 0013 JMP #0015
0xB0080000, // 0014 RAISE 2 R0 R0
0x4C040000, // 0015 LDNIL R1
0x80040200, // 0016 RET 1 R1
0x7002000C, // 0008 JMP #0016
0xAC040002, // 0009 CATCH R1 0 2
0x70020009, // 000A JMP #0015
0xA40E0200, // 000B IMPORT R3 K1
0x60100001, // 000C GETGBL R4 G1
0x8C140702, // 000D GETMET R5 R3 K2
0x581C0003, // 000E LDCONST R7 K3
0x5C200000, // 000F MOVE R8 R0
0x5C240200, // 0010 MOVE R9 R1
0x5C280400, // 0011 MOVE R10 R2
0x7C140A00, // 0012 CALL R5 5
0x7C100200, // 0013 CALL R4 1
0x70020000, // 0014 JMP #0016
0xB0080000, // 0015 RAISE 2 R0 R0
0x4C040000, // 0016 LDNIL R1
0x80040200, // 0017 RET 1 R1
})
),
be_nested_proto(

View File

@ -464,9 +464,9 @@ class Tasmota
try
var compiled = compile(f_name, 'file')
return compiled
except .. as e
except .. as e, m
import string
print(string.format('BRY: failed to load \'%s\' (%s)',f_name,e))
print(string.format('BRY: failed to load \'%s\' (%s - %s)',f_name,e,m))
end
return nil
end