Skip to content

Extend function `from_file` - add assert to handle wrong path to file

Michał Kudela requested to merge kudmich/fix_from_file_mechanism into develop

Previously, passing an option to hived such as --alternate-chain-spec=/wrong/path/to/file.json resulted in an incomprehensible error message.

  • Before:
596526ms chain_plugin.cpp:1528         plugin_initialize    ] Setting custom skeleton key: 5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n
596534ms chain_plugin.cpp:1693         plugin_initialize    ] 11 eof_exception: End Of File
unexpected end of file
    {}
    json.cpp:520 variant_from_stream
596735ms blockchain_worker_thread_pool.cpp:511 shutdown             ] shutting down worker threads
596735ms blockchain_worker_thread_pool.cpp:516 shutdown             ] worker threads successfully shut down
596736ms main.cpp:180                  main                 ] 11 eof_exception: End Of File
unexpected end of file
    {}
    json.cpp:520 variant_from_stream
rethrow
    {}
    chain_plugin.cpp:1693 plugin_initialize
  • After:
736004ms chain_plugin.cpp:1516         plugin_initialize    ] Setting custom skeleton key: 5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n
736004ms chain_plugin.cpp:1681         plugin_initialize    ] 10 assert_exception: Assert Exception
!bi.fail()
Fail to open file /home/not_existing_file.json
    {"p":"/home/not_existing_file.json"}
    json.cpp:999 from_file
736204ms blockchain_worker_thread_pool.cpp:511 shutdown             ] shutting down worker threads
736204ms blockchain_worker_thread_pool.cpp:516 shutdown             ] worker threads successfully shut down
736205ms main.cpp:180                  main                 ] 10 assert_exception: Assert Exception
!bi.fail()
Fail to open file /home/not_existing_file.json
    {"p":"/home/not_existing_file.json"}
    json.cpp:999 from_file
rethrow
    {}
    chain_plugin.cpp:1681 plugin_initialize

@ABW^ @kbotor^

Merge request reports

Loading