sorry the example is a little complex here.
You'll see that the backtrace doesn't include the file/line that actually raised the exception:
diff --git a/src/socket.cr b/src/socket.cr
index fb25d63ae..03bb87de3 100644
--- a/src/socket.cr
+++ b/src/socket.cr
@@ -134,6 +134,7 @@ class Socket < IO
when Errno::EISCONN
return
when Errno::EINPROGRESS, Errno::EALREADY
+ raise "hello"
wait_writable(timeout: timeout) do |error|
return yield IO::Timeout.new("connect timed out")
end
$ cat bad.cr
require "socket"
TCPSocket.new("facebook.com",80)
$ crystal bad.cr
Using compiled compiler at `.build/crystal'
Unhandled exception: hello (Exception)
from src/socket/tcp_socket.cr:137:9 in 'initialize'
from src/socket/tcp_socket.cr:27:3 in 'initialize'
from src/socket/tcp_socket.cr:27:3 in 'new'
from bad.cr:2:1 in '__crystal_main'
from src/crystal/main.cr:97:5 in 'main_user_code'
from src/crystal/main.cr:86:7 in 'main'
from src/crystal/main.cr:106:3 in 'main'
$ crystal -v
Crystal 0.32.0-dev [e1db6c90b] (2019-11-07)
LLVM: 8.0.1
Default target: x86_64-apple-macosx
I think it does but reports the wrong file. Given your patch raise is at line 137 column 9 which matches the first line from src/socket/tcp_socket.cr:137:9 in 'initialize'.
sorry the example is a little complex here. You'll see that the backtrace doesn't include the file/line that actually raised the exception: