Statically typed language th> | Dynamically typed language th> |
---|---|
|
|
Statically typed language th> | Dynamically typed language th> |
---|---|
|
|
--JavaScript (only ** generated location ** remains as ʻe.stack`)
We are looking for more in the comments section at any time!
Ruby
e = Exception.new
raise e
# test.rb:2:in `<main>': Exception (Exception)
Python
e = Exception
raise e
# Traceback (most recent call last):
# File "test.py", line 2, in <module>
# raise e
# Exception
PHP
<?php
$e = new Exception;
throw $e;
/*
PHP Fatal error: Uncaught Exception in test.php:2
Stack trace:
#0 {main}
thrown in test.php on line 2
*/
↑ ** thrown in
** appears, but be careful as it is not the place where you threw it
Java
import java.lang.Exception;
class Main
{
public static void main(String[] args) throws Exception
{
Exception e = new Exception();
throw e;
}
}
/*
Exception in thread "main" java.lang.Exception
at Main.main(Main.java:6)
*/
Scala
object Main {
val e = new Exception
throw e
}
/*
Exception in thread "main" java.lang.Exception
at Main$.delayedEndpoint$Main$1(Main.scala:2)
at Main$delayedInit$body.apply(Main.scala:1)
...
*/
JavaScript
e = new Error;
throw e;
/*
test.js:2
throw e;
^
Error
at Object.<anonymous> (test.js:1:67)
at Module._compile (module.js:413:34)
*/
Recommended Posts