1 /**
2  * D-LevelDB Exceptions
3  *
4  * The library code should only throw these kind of exceptions.
5  *
6  * Copyright: Copyright © 2013 Byron Heads
7  * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
8  * Authors: Byron Heads
9 */
10 /*          Copyright  © 2013 Byron Heads
11  * Distributed under the Boost Software License, Version 1.0.
12  *    (See accompanying file LICENSE_1_0.txt or copy at
13  *          http://www.boost.org/LICENSE_1_0.txt)
14  */
15 module leveldb.exceptions;
16 
17 private import std.conv : to;
18 
19 /**
20  * Base Exception type for library.  We don't do anything fancy, just have a common
21  * exception type that can be caught when using this library.
22  */
23 class LeveldbException : Exception
24 {
25     /// LevelDB returns errors as an internal char*
26     this(char* errptr, string file = __FILE__, size_t line = __LINE__, Throwable next = null)
27     {
28         super(to!string(errptr), file, line, next);
29     }
30 
31     /// Take regular D strings for errors
32     this(string errstr, string file = __FILE__, size_t line = __LINE__, Throwable next = null)
33     {
34         super(errstr, file, line, next);
35     }
36 }