infix
A JIT-Powered FFI Library for C
Loading...
Searching...
No Matches
Ch09_ErrorReporting.c File Reference

Cookbook Chapter 9: Advanced Error Reporting for the Parser. More...

#include <infix/infix.h>
#include <stdio.h>
Include dependency graph for Ch09_ErrorReporting.c:

Functions

static void report_parse_error (const char *signature)
 A helper function that attempts to parse a signature and reports detailed error information on failure.
 
int main ()
 

Detailed Description

Cookbook Chapter 9: Advanced Error Reporting for the Parser.

This example demonstrates how to get detailed, thread-safe error information when an infix API call fails. This is especially useful for providing rich feedback to users when they provide an invalid signature string.

After a parsing function fails, a call to infix_get_last_error() returns an infix_error_details_t struct containing the error code, a human-readable message, and the exact character position of the error in the source string.

Function Documentation

◆ main()

int main ( void  )

◆ report_parse_error()

static void report_parse_error ( const char *  signature)
static

A helper function that attempts to parse a signature and reports detailed error information on failure.

Parameters
signatureThe signature string to parse.