Module Cli.Errors

Cli Errors

This module defines error-handling functions for the CLI (Command Line Interface) of the interpreter. Each function returns a result type that encapsulates either a successful value or a list of detailed errors.

Overview

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

invalid_logger_level level is used to indicate that the provided logger level level is invalid.

  • parameter level

    The invalid logger level as a string.

  • returns

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

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 is used to indicate that the provided command commands is invalid.

  • parameter errors

    (optional) A list of detailed errors to include.

  • parameter nearest

    (optional) The nearest valid command as a suggestion.

  • parameter distance

    (optional) The edit distance between the invalid command and the nearest valid command.

  • parameter commands

    The invalid command as a list of strings.

  • 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 is used to indicate that the specified file filepath does not exist.

  • parameter errors

    (optional) A list of detailed errors to include.

  • parameter filepath

    The path to the file that does not exist.

  • 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 () is used to indicate that the file has an unsupported extension.

  • parameter errors

    (optional) A list of detailed errors to include.

  • parameter supported

    The supported file extension(s) as a string.

  • parameter got

    (optional) The invalid file extension that was provided.

  • returns

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