Module Repl.Errors

Errors

This module defines a set of error-handling functions for the REPL (Read-Eval-Print Loop) of the interpreter. These functions return results that encapsulate potential errors in a structured way, allowing for detailed error reporting and handling.

val invalid_command : ?errors:Ast.Error.detailed_error list -> ?nearest:string -> ?distance:int -> string list -> ('a, Ast.Error.detailed_error list) Stdlib.result

invalid_command ?errors ?nearest ?distance commands returns an error result indicating that the given command is invalid. Optionally, it can include a list of detailed errors, the nearest valid command, and the distance (e.g., Levenshtein distance) to the nearest valid command.

  • parameter errors

    Optional list of detailed errors.

  • parameter nearest

    Optional nearest valid command.

  • parameter distance

    Optional distance to the nearest valid command.

  • parameter commands

    The list of commands to validate.

  • returns

    A result containing either a valid value or a list of detailed errors.

val file_not_exists : ?errors:Ast.Error.detailed_error list -> string -> ('a, Ast.Error.detailed_error list) Stdlib.result

file_not_exists ?errors filepath returns an error result indicating that the specified file does not exist.

  • parameter errors

    Optional list of detailed errors.

  • parameter filepath

    The path of the file to check.

  • returns

    A result containing either a valid value or a list of detailed errors.

val invalid_file_extension : ?errors:Ast.Error.detailed_error list -> supported:string -> ?got:string -> unit -> ('a, Ast.Error.detailed_error list) Stdlib.result

invalid_file_extension ?errors ~supported ?got () returns an error result indicating that the file has an invalid extension. It specifies the supported extensions and optionally the extension that was provided.

  • parameter errors

    Optional list of detailed errors.

  • parameter supported

    The supported file extensions.

  • parameter got

    Optional extension that was provided.

  • returns

    A result containing either a valid value or a list of detailed errors.

val invalid_export_mode : ?errors:Ast.Error.detailed_error list -> string -> ('a, Ast.Error.detailed_error list) Stdlib.result

invalid_export_mode ?errors mode returns an error result indicating that the specified export mode is invalid.

  • parameter errors

    Optional list of detailed errors.

  • parameter mode

    The invalid export mode.

  • returns

    A result containing either a valid value or a list of detailed errors.

val invalid_view_mode : ?errors:Ast.Error.detailed_error list -> string -> ('a, Ast.Error.detailed_error list) Stdlib.result

invalid_view_mode ?errors mode returns an error result indicating that the specified view mode is invalid.

  • parameter errors

    Optional list of detailed errors.

  • parameter mode

    The invalid view mode.

  • returns

    A result containing either a valid value or a list of detailed errors.

val invalid_view_combination : ?errors:Ast.Error.detailed_error list -> ?hint:string -> string -> string -> ('a, Ast.Error.detailed_error list) Stdlib.result

invalid_view_combination ?errors ?hint view1 view2 returns an error result indicating that the combination of the two specified view modes is invalid. Optionally, it can include a hint for resolving the issue.

  • parameter errors

    Optional list of detailed errors.

  • parameter hint

    Optional hint for resolving the issue.

  • parameter view1

    The first view mode.

  • parameter view2

    The second view mode.

  • returns

    A result containing either a valid value or a list of detailed errors.

val invalid_number_rollback : ?errors:Ast.Error.detailed_error list -> int -> ('a, Ast.Error.detailed_error list) Stdlib.result

invalid_number_rollback ?errors n returns an error result indicating that the specified number of rollbacks is invalid.

  • parameter errors

    Optional list of detailed errors.

  • parameter n

    The invalid number of rollbacks.

  • returns

    A result containing either a valid value or a list of detailed errors.