PuzzleD

D Interface to libpuzzle
git clone git://xatko.vsos.ethz.ch/PuzzleD.git
Log | Files | Refs

commit a1c37a4e11ffac14502d01bea17060b84c3aa9e5
parent 14b18efb6bd5d991591779432d395f603e5659f3
Author: Dominik Schmidt <das1993@hotmail.com>
Date:   Thu, 27 Aug 2015 12:05:15 +0200

Introduce custom Exception PuzzleException.

Diffstat:
puzzle.d | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/puzzle.d b/puzzle.d @@ -93,6 +93,12 @@ static bool valid(in PuzzleContext *ctx){ return (ctx!=null && valid(*ctx)); } +class PuzzleException : Exception{ + pure nothrow @safe this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null){ + super(msg,file,line,next); + } +} + struct Puzzle{ PuzzleContext ctx; void initialize() @@ -132,7 +138,7 @@ struct DVec{ } void load(string f){ if(puzzle_fill_dvec_from_file(ctx, &vec, toStringz(f))!=0){ - throw new Exception("Couldn't read the file"); + throw new PuzzleException("Couldn't read from file"); } } void load(void mem[]){ @@ -168,7 +174,7 @@ struct CVec{ } void load(string f){ if(puzzle_fill_cvec_from_file(ctx, &vec, toStringz(f))!=0){ - throw new Exception("Couldn't read the file"); + throw new PuzzleException("Couldn't read from file"); } } void load(void mem[]){