You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the taichi code base, there are too many kinds of error types like KernelDefError, KernelArgError, InvalidOperationError, TaichiSyntaxError, RuntimeError, TypeError, ValueError, and even Exception. Moreover, there is no standard on which error should be raised in which situation. So, we should standardize the error types.
Goals
Make rules on when should we use which error type.
Let the error types inherit the corresponding python errors.
Change the errors in the code base to comply with the rules.
Proposal
TaichiCompilationError
The base class of all errors generated in the compilation process.
Used when an error in the compilation process occurs that does not fit in other errors.
TaichiTypeError
Inherits TaichiCompilationError and TypeError
Used when a type error is detected when performing type checks.
TaichiSyntaxError
Inherits TaichiCompilationError and SyntaxError
Used when encountering a syntax that taichi does not support.
TaichiNameError
Inherits TaichiCompilationError and NameError
Used when taichi encounters a undefined name.
TaichiRuntimeError
Inherits RuntimeError
Used when a compiled taichi program fails to execute.
TaichiRuntimeTypeError
Inherits TaichiRuntimeError and TypeError
Used when the type of an argument does not match the corresponding kernel parameter.
The text was updated successfully, but these errors were encountered:
I suggest not to TaichiTypeError inherit from TaichiCompilationError. It is possible to produce a type error at compile time. E.g. your kernel takes in a vec3, but a vec4 is passed in.
I suggest not to TaichiTypeError inherit from TaichiCompilationError. It is possible to produce a type error at compile time. E.g. your kernel takes in a vec3, but a vec4 is passed in.
I would consider this case as a TaichiRuntimeError because it doesn't belong to the Taichi compilation process. Instead, the situation is that the compiled program fails to execute.
Motivation
In the taichi code base, there are too many kinds of error types like
KernelDefError
,KernelArgError
,InvalidOperationError
,TaichiSyntaxError
,RuntimeError
,TypeError
,ValueError
, and evenException
. Moreover, there is no standard on which error should be raised in which situation. So, we should standardize the error types.Goals
Proposal
TaichiCompilationError
TaichiTypeError
TaichiCompilationError
andTypeError
TaichiSyntaxError
TaichiCompilationError
andSyntaxError
TaichiNameError
TaichiCompilationError
andNameError
TaichiRuntimeError
RuntimeError
TaichiRuntimeTypeError
TaichiRuntimeError
andTypeError
The text was updated successfully, but these errors were encountered: