;;--------------------------------------------------------------------------
;; AriNET Project in Informatics IA by Dominique Guinard
;; dominique.guinard@unifr.ch
;;--------------------------------------------------------------------------
;; error message
;;--------------------------------------------------------------------------
; ------------------------------------------------------------
; ABSTRACT:
; *********
; This file contains the functions related to error
; managing.
; ------------------------------------------------------------
; ------------------------------------------------------------
; error breaking
; ------------------------------------------------------------
; Note : the error breaking global variable "error-status" is not
; part of the-global-environment so it is no reserved keyword
; for the end-user of AriNET
(define errors-status #f)
(define (reset-errors)
(set! errors-status #f))
(define (disable-errors)
(set! errors-status #t))
; ------------------------------------------------------------
; end of error breaking
; ------------------------------------------------------------
; ------------------------------------------------------------
; functions for debug menu
; ------------------------------------------------------------
(define all-errors #f)
(define (only-first-error-proc MItem CEvent)
(set! all-errors #f)
(print-to-transcript "INFO -- Only first errors will be displayed.")
(transcript_prompt))
(define (all-errors-proc MItem CEvent)
(set! all-errors #t)
(print-to-transcript "INFO -- All errors will be displayed.")
(transcript_prompt))
; ------------------------------------------------------------
; end of functions for debug menu
; ------------------------------------------------------------
;(define (ErrorMsg msg type)
; (message-box "Error" msg))
(define (errormsg msg type)
(cond ((and (not errors-status) (symbol=? type 'code))
(if (not all-errors)
(disable-errors))
(message-box "Bug Report" "The errorhandeler detected that this
error might be a bug internal to AriNET.
If what you entered seems correct to you,
please report this error message, together with a copy of
the commands you entered, to :
dominique.guinard@unifr.ch
Thanks in advance.")
(print-error-msg msg))
((and (not errors-status) (symbol=? type 'user))
(if (not all-errors)
(disable-errors))
(print-error-msg msg))
((and (not errors-status) (symbol=? type 'scheme))
(if (not all-errors)
(disable-errors))
(print-error-msg msg))
;else just in case 'user or 'code was misspelled somewhere within
;the code.
((not errors-status)
(if (not all-errors)
(disable-errors))
(print-error-msg))))
; ------------------------------------------------------------
; end of error message
; ------------------------------------------------------------