PageRenderTime 39ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/core/error.d

http://github.com/wilkie/djehuty
D | 49 lines | 27 code | 9 blank | 13 comment | 0 complexity | e532f395f9ec67b100835d3e85e923e6 MD5 | raw file
  1. /*
  2. * error.d
  3. *
  4. * This module implements the Error objects useable by the system.
  5. * This objects are for irrecoverable failures.
  6. *
  7. * Originated: May 8th, 2010
  8. *
  9. */
  10. module core.error;
  11. import core.definitions;
  12. // Description: This is for non irrecoverable failure.
  13. class Error : Exception {
  14. this(string msg, string file = "", ulong line = 0) {
  15. super(msg, file, line);
  16. }
  17. private:
  18. // Error _next;
  19. }
  20. abstract class RuntimeError : Error {
  21. this(string msg, string file, ulong line){
  22. super(msg,file,line);
  23. }
  24. static:
  25. // Description: This Error is thrown when assertions fail.
  26. class Assert : RuntimeError {
  27. this(string msg, string file, ulong line) {
  28. super("Assertion `" ~ msg ~ "` failed", file, line);
  29. }
  30. this(string file, ulong line) {
  31. super("Assertion failed",file,line);
  32. }
  33. }
  34. // Description: This Error is thrown when a switch statement does not have a default and there is no case available.
  35. class NoDefaultCase : RuntimeError {
  36. this(string file, ulong line) {
  37. super("Switch has no default",file,line);
  38. }
  39. }
  40. }