blob: 5f40c094e3f2f2b475db6d3b6b830bfa313127f4 (
plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
|
module Struct.Error exposing (Type, Mode(..), new, to_string)
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
type Mode =
IllegalAction
| Programming
| Unimplemented
| Networking
| Failure
type alias Type =
{
mode: Mode,
message: String
}
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
new : Mode -> String -> Type
new mode str =
{
mode = mode,
message = str
}
to_string : Type -> String
to_string e =
(
(case e.mode of
Failure -> "The action failed: "
IllegalAction -> "Request discarded: "
Programming -> "Error in the program (please report): "
Unimplemented -> "Update discarded due to unimplemented feature: "
Networking -> "Error while conversing with the server: "
)
++ e.message
)
|