Capture errors and debugging information in your functions
While each Modus SDK offers similar capabilities, the APIs and usage may vary between languages.
Modus Console APIs documentation is available on the following pages:
The Modus Console APIs allow you to capture information from your functions, such as errors and other information that can help you debug your functions.
Unlike other APIs, the console
namespace is globally available by default in
all AssemblyScript functions, you donβt need to import it.
The Console APIs mimic the behavior of the AssemblyScript
console
object, but
directs the output to Hypermode as follows:
console.error
is also sent to the GraphQL response.throw
keyword are also sent to the GraphQL response.The APIs in the console
namespace are below, organized by category.
Weβre constantly introducing new APIs through ongoing development with early users. Please open an issue if you have ideas on what would make Modus even more powerful for your next app!
Asserts that a condition is true, and logs an error if itβs not.
The condition to assert. Typically a boolean value. In the case of an object,
asserts that the object isnβt null
.
An error message to log, if the assertion is false.
Generate a log message, with no particular logging level.
A message you want to log.
Generate a log message with the βdebugβ logging level.
A debug message you want to log.
Generate a log message with the βinfoβ logging level.
An informational message you want to log.
Generate a log message with the βwarningβ logging level.
A warning message you want to log.
Generate a log message with the βerrorβ logging level.
An error message you want to log.
Starts a new timer using the specified label.
An optional label for the timer.
Logs the current value of a timer previously started with console.time
.
An optional label for the timer.
Logs the current value of a timer previously started with console.time
, and
discards the timer.
An optional label for the timer.