4.3.3 Signaling errors in macro transformers

syntax: (syntax-error message args )

syntax-error behaves similarly to error (see Exceptions) except that implementations with an expansion pass separate from evaluation should signal an error as soon as syntax-error is expanded. This can be used as a syntax-rules template for a pattern that is an invalid use of the macro, which can provide more descriptive error messages. Message is a string literal, and args arbitrary expressions providing additional information. Applications cannot count on being able to catch syntax errors with exception handlers or guards.

(define-syntax simple-let
  (syntax-rules ()
    (((head ... ((yvaltail)
        body1 body2 ...)
     (syntax-error
      "expected an identifier but got"
      (y)))
    ((((name val...body1 body2 ...)
     ((lambda (name ...body1 body2 ...)
       val ...))))