lib & contrib: update imports
[nit.git] / lib / neo4j / error.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # This file is free software, which comes along with NIT. This software is
4 # distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
5 # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
6 # PARTICULAR PURPOSE. You can modify it is you want, provided this header
7 # is kept unaltered, and a notification of the changes is added.
8 # You are allowed to redistribute it and sell it, alone or is a part of
9 # another product.
10
11 # Errors thrown by the `neo4j` library.
12 module neo4j::error
13
14 import json::static
15 import json
16
17 # An error thrown by the `neo4j` API.
18 #
19 # var error = new NeoError("ErrorMessage", "ErrorName")
20 # assert error.to_json == """{"message":"ErrorMessage","cause":null,"error":"ErrorName"}"""
21 class NeoError
22 super Error
23 super Jsonable
24 serialize
25
26 # The name of the error.
27 #
28 # Used to programmatically distinguish this kind of error from others.
29 var name: String is serialize_as "error"
30
31 redef fun to_s do return "[{name}] {super}"
32 end