ref: 90664173e5c72d0b31bdfd2c467134b3cfb3623a
dir: /error.c/
#include <u.h> #include <libc.h> #include <bio.h> #include "dat.h" #include "fns.h" Term * instantiationerror(void) { return mkatom(L"instantiation_error"); } Term * typeerror(Rune *validtype, Term *culprit) { Term *valid = mkatom(validtype); valid->next = copyterm(culprit, nil); return mkcompound(L"type_error", 2, valid); } Term * domainerror(Rune *validdomain, Term *culprit) { Term *valid = mkatom(validdomain); valid->next = copyterm(culprit, nil); return mkcompound(L"domain_error", 2, valid); } Term * existenceerror(Rune *objecttype, Term *culprit) { Term *obj = mkatom(objecttype); obj->next = copyterm(culprit, nil); return mkcompound(L"existence_error", 2, obj); } Term * permissionerror(Rune *operation, Rune *permissiontype, Term *culprit) { Term *op = mkatom(operation); op->next = mkatom(permissiontype); op->next->next = copyterm(culprit, nil); return mkcompound(L"permission_error", 3, op); } Term * representationerror(Rune *flag) { Term *f = mkatom(flag); return mkcompound(L"representation_error", 1, f); } Term * evaluationerror(Rune *error) { Term *e = mkatom(error); return mkcompound(L"evaluation_error", 1, e); } Term * resourceerror(Rune *resource) { Term *res = mkatom(resource); return mkcompound(L"resource_error", 1, res); } Term * syntaxerror(Rune *error) { Term *e = mkatom(error); return mkcompound(L"syntax_error", 1, e); }