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

Using import (require) function "Cant find file/folder" exception flow not nicely handled #11

Open
calebrepkes opened this issue Feb 24, 2016 · 1 comment

Comments

@calebrepkes
Copy link

Hey,

While building and expanding my code, I made two mistakes both leading to the same type of exception handling:

Engine: 462458762 - Exception handling routing table request com.sandbox.common.models.ServiceScriptException: Cannot find module: ./mockedServices/MYFILE.js in <sandbox-internal> at line number 243 at column number 6 at com.sandbox.runtime.js.services.Service.loadService(Service.java:202) ~[sandbox:na] at com.sandbox.runtime.js.services.Service.initialize(Service.java:102) ~[sandbox:na] at com.sandbox.runtime.js.services.Service.handleRoutingTableRequest(Service.java:148) ~[sandbox:na] at com.sandbox.runtime.HttpRequestHandler.handle(HttpRequestHandler.java:100) [sandbox:na] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [sandbox:na] at org.eclipse.jetty.server.Server.handle(Server.java:499) [sandbox:na] at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) [sandbox:na] at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) [sandbox:na] at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) [sandbox:na] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) [sandbox:na] at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) [sandbox:na] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_74] Error processing request com.sandbox.common.models.ServiceScriptException: Cannot find module: ./mockedServices/MYFILE.js in <sandbox-internal> at line number 243 at column number 6 at com.sandbox.runtime.js.services.Service.loadService(Service.java:202) ~[sandbox:na] at com.sandbox.runtime.js.services.Service.initialize(Service.java:102) ~[sandbox:na] at com.sandbox.runtime.js.services.Service.handleRoutingTableRequest(Service.java:148) ~[sandbox:na] at com.sandbox.runtime.HttpRequestHandler.handle(HttpRequestHandler.java:100) ~[sandbox:na] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [sandbox:na] at org.eclipse.jetty.server.Server.handle(Server.java:499) [sandbox:na] at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) [sandbox:na] at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) [sandbox:na] at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) [sandbox:na] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) [sandbox:na] at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) [sandbox:na] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_74]

  1. My first mistake was not adding / in the following var:
    var routeMYROUTE = require('./mockedServices/MYFILE')

  2. My second mistake was saving the file in the root folder, instead of in the folder ./mockedServices.

Would be nicer if the exception handling could point a bit better to the spot where its going wrong. This was my main.js file line 22. While the exception handler says its at line number 243, while I don't even have that line in both my main.js or MYFILE.js

Just my two cents, trying to give you feedback.

Note: Mistakes didnt happen with the same operation. But I noticed the same handling. And took me quite a while to find what was going wrong. Especially with the second thing. As code wise everything looked good.

@nhoughto
Copy link
Contributor

Yep the error handling could be more obvious, will add a task to the backlog to improve it. Thanks for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants