diff --git a/pkgs/racket-test-core/tests/racket/prompt.rktl b/pkgs/racket-test-core/tests/racket/prompt.rktl index c1e44aefd2..d8084736d6 100644 --- a/pkgs/racket-test-core/tests/racket/prompt.rktl +++ b/pkgs/racket-test-core/tests/racket/prompt.rktl @@ -668,6 +668,22 @@ (default-continuation-prompt-tag) list) +;;---------------------------------------- +;; Check error message as "result" or not + +(err/rt-test (call-with-continuation-prompt (lambda () (abort-current-continuation (default-continuation-prompt-tag)))) + exn:fail:contract:arity? + #rx"result arity mismatch") +(err/rt-test (call-with-continuation-prompt (lambda () (abort-current-continuation (default-continuation-prompt-tag))) + (default-continuation-prompt-tag)) + exn:fail:contract:arity? + #rx"result arity mismatch") +(err/rt-test (call-with-continuation-prompt (lambda () (abort-current-continuation (default-continuation-prompt-tag))) + (default-continuation-prompt-tag) + (lambda (x) x)) + exn:fail:contract:arity? + #rx": arity mismatch") + ;;---------------------------------------- (report-errs) diff --git a/racket/src/cs/rumble/control.ss b/racket/src/cs/rumble/control.ss index 596f8ae08e..652c79ef4e 100644 --- a/racket/src/cs/rumble/control.ss +++ b/racket/src/cs/rumble/control.ss @@ -244,9 +244,17 @@ (apply proc args)))])) (define (make-default-abort-handler tag) - (lambda (abort-thunk) + (case-lambda + [(abort-thunk) (check 'default-continuation-prompt-handler (procedure-arity-includes/c 0) abort-thunk) - (call-with-continuation-prompt abort-thunk tag #f))) + (call-with-continuation-prompt abort-thunk tag #f)] + [args + ;; report arity error as result-arity error + (apply raise-result-arity-error + 'call-with-continuation-prompt + 1 + "\n in: application of default prompt handler" + args)])) (define (resume-metacontinuation results) ;; pop a metacontinuation frame diff --git a/racket/src/cs/rumble/error.ss b/racket/src/cs/rumble/error.ss index 9eee2e36f8..c592acf3d2 100644 --- a/racket/src/cs/rumble/error.ss +++ b/racket/src/cs/rumble/error.ss @@ -419,8 +419,8 @@ (if who (string-append (symbol->string who) ": ") "") "result arity mismatch;\n" " expected number of values not received\n" - " received: " (number->string (length args)) "\n" - " expected: " (number->string num-expected-args) + " expected: " (number->string num-expected-args) "\n" + " received: " (number->string (length args)) (or where "") (arguments->context-string args)) (current-continuation-marks))))