package bimage

  1. Overview
  2. Docs

Source file error.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
type t =
  [ `Invalid_shape
  | `Invalid_kernel_shape of int * int
  | `Invalid_input of int
  | `Invalid_layout
  | `Invalid_color
  | `Msg of string ]

let to_string = function
  | `Invalid_shape ->
      "invalid shape"
  | `Invalid_kernel_shape (r, c) ->
      Printf.sprintf "invalid kernel shape: %dx rows x %d cols" r c
  | `Invalid_input index ->
      Printf.sprintf "invalid input index: %d" index
  | `Invalid_layout ->
      "invalid layout"
  | `Invalid_color ->
      "invalid color"
  | `Msg m ->
      m


exception Exc of t

let exc x = raise (Exc x)

let unwrap = function
  | Ok x ->
      x
  | Error e ->
      exc e
OCaml

Innovation. Community. Security.