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

Some errors are being reported as 5xx, when they should be a 4xx series #44

Open
lukechurch opened this issue May 14, 2015 · 2 comments

Comments

@lukechurch
Copy link
Contributor

Consider e.g. the trace at the end of this message.

In this case the server is being sent bad data, which is causing RPC to fail to find a matching method. This is a problem with the client, not the server, so should probably be returning HTTP 400, not HTTP 500.

rpc: Invoking API: /dartservices/v1 with HTTP method: POST on path: /dartservices/v1/analyze.
rpc: Failed to decode request body: FormatException: Unexpected character (at offset 1)
rpc:
Response
Status Code: 500
Headers:
cache-control: no-cache, no-store, must-revalidate
content-type: application/json; charset=utf-8
expires: 0
pragma: no-cache
Exception:
RPC Error with status: 500 and message: Class 'CommonServer' has no instance method 'analyze' with matching arguments.

  NoSuchMethodError: incorrect number of arguments passed to method named 'analyze'
  Receiver: Instance of 'CommonServer'
  Tried calling: analyze()
  Found: analyze(request)


  Stack:
      #0      Object._noSuchMethod (dart:core-patch/object_patch.dart:42)
      #1      Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
      #2      _LocalInstanceMirror._invoke (dart:mirrors-patch/mirrors_impl.dart:536)
      #3      _LocalInstanceMirror.invoke (dart:mirrors-patch/mirrors_impl.dart:532)
      #4      ApiConfigMethod.invokeWithBody.<invokeWithBody_async_body> (package:rpc/src/config/method.dart:224:22)
      #5      _asyncCatchHelper.<anonymous closure> (dart:core-patch/core_patch.dart:15)
      #6      _rootRunBinary (dart:async/zone.dart:914)
      #7      _CustomZone.runBinary (dart:async/zone.dart:812)
      #8      _Future._propagateToListeners.handleError (dart:async/future_impl.dart:521)
      #9      _Future._propagateToListeners (dart:async/future_impl.dart:580)
      #10     _Future._completeError (dart:async/future_impl.dart:376)
      #11     _rootRunBinary (dart:async/zone.dart:914)
      #12     _CustomZone.runBinary (dart:async/zone.dart:812)
      #13     _CustomZone.runBinaryGuarded (dart:async/zone.dart:720)
      #14     _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:358)
      #15     _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:371)
      #16     _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:279)
      #17     _SinkTransformerStreamSubscription._addError (dart:async/stream_transformers.dart:81)
      #18     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:121)
      #19     _rootRunUnary (dart:async/zone.dart:902)
      #20     _CustomZone.runUnary (dart:async/zone.dart:804)
      #21     _CustomZone.runUnaryGuarded (dart:async/zone.dart:712)
      #22     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341)
      #23     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:270)
      #24     _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:140)
      #25     _ForwardingStream._handleData (dart:async/stream_pipe.dart:104)
      #26     _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:172)
      #27     _rootRunUnary (dart:async/zone.dart:902)
      #28     _CustomZone.runUnary (dart:async/zone.dart:804)
      #29     _CustomZone.runUnaryGuarded (dart:async/zone.dart:712)
      #30     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341)
      #31     _DelayedData.perform (dart:async/stream_impl.dart:595)
      #32     _StreamImplEvents.handleNext (dart:async/stream_impl.dart:711)
      #33     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:671)
      #34     _rootRun (dart:async/zone.dart:891)
      #35     _CustomZone.run (dart:async/zone.dart:796)
      #36     _CustomZone.runGuarded (dart:async/zone.dart:704)
      #37     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:729)
      #38     _rootRun (dart:async/zone.dart:895)
      #39     _CustomZone.run (dart:async/zone.dart:796)
      #40     _CustomZone.runGuarded (dart:async/zone.dart:704)
      #41     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:729)
      #42     _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
      #43     _asyncRunCallback (dart:async/schedule_microtask.dart:48)
      #44     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
      #45     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:143)
@FaisalAbid
Copy link
Contributor

Thanks for this, i'll take a look into this shortly.

@rahulakash
Copy link

Getting the same error, any solutions?

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

No branches or pull requests

3 participants