interpret_exception_message

Function

def interpret_exception_message(e):
    logging.debug(e)
    if 'insufficient funds for gas * price + value' in str(e):
        return 'Not enough PLS'
    elif 'transfer amount exceeds balance' in str(e):
        return 'Not enough tokens'
    return e

Description

  • Log the message to debug

  • Check if certain phrases exist in the message

  • Return a better description of it if it’s available