PageRenderTime 59ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/runtimes/dyndrt/core/error.d

http://github.com/xomboverlord/xomb
D | 58 lines | 36 code | 10 blank | 12 comment | 0 complexity | 0b6e7c6f3b09bf54818d3d9b53ae9046 MD5 | raw file
Possible License(s): WTFPL
  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.exception;
  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. }
  18. abstract class RuntimeError : Error {
  19. this(string msg, string file, ulong line){
  20. super(msg,file,line);
  21. }
  22. static:
  23. // Description: This Error is thrown when assertions fail.
  24. class Assert : RuntimeError {
  25. this(string msg, string file, ulong line) {
  26. super("Assertion `" ~ msg ~ "` failed", file, line);
  27. }
  28. this(string file, ulong line) {
  29. super("Assertion failed",file,line);
  30. }
  31. }
  32. class CyclicDependency : RuntimeError {
  33. this(string moduleNameA, string moduleNameB) {
  34. super("Cyclic Dependency detected between " ~ moduleNameA ~ " and " ~ moduleNameB, "", 0);
  35. }
  36. }
  37. // Description: This Error is thrown when a switch statement does not have a default and there is no case available.
  38. class NoDefaultCase : RuntimeError {
  39. this(string file, ulong line) {
  40. super("Switch has no default",file,line);
  41. }
  42. }
  43. class NoCompare : RuntimeError {
  44. this(string className) {
  45. super("Class " ~ className ~ " needs an opCmp.", "", 0);
  46. }
  47. }
  48. }