errors.odin 1006 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package flags
  2. import "core:os"
  3. Parse_Error_Reason :: enum {
  4. None,
  5. // An extra positional argument was given, and there is no `varg` field.
  6. Extra_Positional,
  7. // The underlying type does not support the string value it is being set to.
  8. Bad_Value,
  9. // No flag was given by the user.
  10. No_Flag,
  11. // No value was given by the user.
  12. No_Value,
  13. // The flag on the struct is missing.
  14. Missing_Flag,
  15. // The type itself isn't supported.
  16. Unsupported_Type,
  17. }
  18. // Raised during parsing, naturally.
  19. Parse_Error :: struct {
  20. reason: Unified_Parse_Error_Reason,
  21. message: string,
  22. }
  23. // Raised during parsing.
  24. // Provides more granular information than what just a string could hold.
  25. Open_File_Error :: struct {
  26. filename: string,
  27. errno: os.Error,
  28. mode: int,
  29. perms: int,
  30. }
  31. // Raised during parsing.
  32. Help_Request :: distinct bool
  33. // Raised after parsing, during validation.
  34. Validation_Error :: struct {
  35. message: string,
  36. }
  37. Error :: union {
  38. Parse_Error,
  39. Open_File_Error,
  40. Help_Request,
  41. Validation_Error,
  42. }