Skip to content

xgrammar::from_json_schema can throw uncaught c++ exceptions #3

@414owen

Description

@414owen

If you pass an invalid schema to Grammar::from_json_schema, a c++ exception is thrown, which isn't caught by the xgrammar-rs bindings, and causes the rust process to exit.

An example output:

libc++abi: terminating due to uncaught exception of type xgrammar::LogFatalError: [12:33:08] .../cpp/json_schema_converter.cc:2181: minItems is greater than the number of prefixItems, but additional items are not allowed: 2 > 0

It would be nice to return a Result, so that rust can continue execution.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions