handle tinydtls error code and spit lua errors