Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptic message "Error is null" #317

Closed
jcubic opened this issue Feb 25, 2024 · 3 comments
Closed

Cryptic message "Error is null" #317

jcubic opened this issue Feb 25, 2024 · 3 comments
Labels
bug Something isn't working
Milestone

Comments

@jcubic
Copy link
Collaborator

jcubic commented Feb 25, 2024

Got weird error when writing function that read whole file:

(define (read-file file)
  (call-with-input-file file
    (lambda (port)
      (let loop ((char (read-char port)) (result '()))
        (if (eof-object? char)
            (string (reverse result))
            (loop (read-char port) (cons char result)))))))

The code should call (apply string (reverse result)) but instead of nice error about invalid type I got this error instead:

lips> (read-file "test.txt")
Error is null
@jcubic jcubic added the bug Something isn't working label Feb 25, 2024
@jcubic
Copy link
Collaborator Author

jcubic commented Feb 25, 2024

Inside this expression:

(define (read-file file)
  (call-with-input-file file
    (lambda (port)
      (let loop ((char (read-char port)) (result '()))
        (print (string (reverse result)))))))

It only happens if there is read-char if I remove it, I get a normal error:

Expecting character got nil in expression string

@jcubic
Copy link
Collaborator Author

jcubic commented Feb 25, 2024

This is simplified reproduction:

(try (begin (Promise.resolve) (typecheck "test" 10 "string")) (finally))

@jcubic
Copy link
Collaborator Author

jcubic commented Feb 25, 2024

This gives a NodeJS warning:

(try (try (typecheck "test" 10 "string") (finally)) (catch (e) e))

(node:2390128) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 6)

jcubic added a commit that referenced this issue Feb 25, 2024
@jcubic jcubic closed this as completed Feb 25, 2024
@jcubic jcubic added this to the 1.0 milestone Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant