raldone01 / godot_addon_gdlogging

Logging addon for godot 4
MIT License
12 stars 0 forks source link

Error using Log.format_error(): Invalid get index 'Node(logger.gd)::error' #3

Closed likadev closed 5 months ago

likadev commented 5 months ago

The following code in logger.gd:697 has a bug where it incorrectly indexes "error" instead of "p_error":

static func format_error(p_error: int) -> String:
    if ERROR_MESSAGES.has(p_error):
        return ERROR_MESSAGES[error]
    return "Unknown p_error (%d)." % p_error

Calling like this:

    if data.load_data() != OK:
        logger.error("Error loading save file: %s" % Log.format_error(FileAccess.get_open_error()))

Changing "error" to "p_error" fixes the crash.

raldone01 commented 5 months ago

Fixed in v1.1.1.