Home
Ratchet Library :: API Reference
API  ·  Manual

Module ratchet.error

A ratchet.error object is thrown in most cases when ratchet functions error. This object exposes certain information to present to the user or to make programmatic decisions based on. Converting these objects to a string presents human-readable information about the error.

Functions

is (error, code) Checks is the code assigned to an error message matches the given code.
new (description, code, func, file, line, syscall, errno, descripion) This function allows manual creation of error objects.


Functions

is (error, code)
Checks is the code assigned to an error message matches the given code. This function is also exposed as a method of ratchet.error objects.

Parameters

  • error: the ratchet.error object to check.
  • code: the code to compare against.

Return value:

true if the error matches the code, false otherwise.
new (description, code, func, file, line, syscall, errno, descripion)
This function allows manual creation of error objects. Usually it is created automatically by ratchet functions when an error occurs. The names of the parameters to this function are also the indices to access the information on a created ratchet.error object.

Parameters

  • description:
  • code: a string code that can identify the error message.
  • func: optional string identifying the function throwing the error.
  • file: optional C file where the error was thrown.
  • line: optional C file line number where the error was thrown.
  • syscall: optional string identifying system call causing the error.
  • errno: optional integer identifying the system error code.
  • descripion: human-readable description of the error.

Return value:

a new ratchet.error object.