Coder Social home page Coder Social logo

Comments (12)

zfbot avatar zfbot commented on June 1, 2024

This issue was ported from the ZF2 Jira Issue Tracker at
http://framework.zend.com/issues/browse/ZF2-181

Known GitHub users mentioned in the original message or comment:
@adamlundrigan, @ralphschindler

from zendframework.

ralphschindler avatar ralphschindler commented on June 1, 2024

Is this still an issue?

from zendframework.

djskinner avatar djskinner commented on June 1, 2024

Actually, I think the current behaviour is correct according to the spec, although it is slightly unclear.

Initially I thought that any integer outside of the reserved range was a value error code. However, looking more closely at the spec (http://www.jsonrpc.org/specification#error_object):

  1. "The error codes from and including -32768 to -32000 are reserved for pre-defined errors."
  2. -32000 to -32099 Server error Reserved for implementation-defined server-errors.
  3. The remainder of the space is available for application defined errors.

If application errors are the same as implementation-defined server-errors then the current behaviour is correct. I guess it depends on your interpretation.

from zendframework.

Loxrie avatar Loxrie commented on June 1, 2024

I think it's a mistake to close this ticket. There is a related one here (http://framework.zend.com/issues/browse/ZF-11991) that led to this ticket being opened. It contains more discussion. Perhaps it could be re-opened?

from zendframework.

djskinner avatar djskinner commented on June 1, 2024

I agree. The spec is a bit unclear and I've changed my mind again since my last comment. The way I now see it is that application-defined error codes can be any integer outside of the range -32768 to -32000. Zend/Json/Server should prevent applications raising errors with codes in the reserved range but still needs to be able to use the reserved codes in its own operation in order to conform with JSON-RPC.

from zendframework.

Loxrie avatar Loxrie commented on June 1, 2024

That was my interpretation too. The specification is rather fluffy in its use of english.

from zendframework.

rkoe avatar rkoe commented on June 1, 2024

I'm one of the main authors of the JSON-RPC 2.0 specification.
The correct interpretation is:

  • -32768 to -32000 / pre-defined errors: These error-codes and their meanings are defined by the JSON-RPC 2.0 specification.
  • -32099 to -32000 / implementation-defined server-errors: These error-codes can be used for JSON-RPC 2.0 servers/frameworks/libraries for their own errors (e.g. if the JSON-RPC-server itself fails).
  • all other codes (>-32000 or <-32768) / application defined errors: These can freely be used by procedures which are called via JSON-RPC.

Hope this helps.
If you have any more questions about JSON-RPC, please mail me or write a mail to the JSON-RPC mailinglist
[email protected].

from zendframework.

djskinner avatar djskinner commented on June 1, 2024

Thanks for that clarification rkoe. This issue needs to be re-opened then.

from zendframework.

Loxrie avatar Loxrie commented on June 1, 2024

Excellent thank you. It'd be good to get this into V2.

On 19 Mar 2013, at 18:31, rkoe [email protected] wrote:

I'm one of the main authors of the JSON-RPC 2.0 specification.
The correct interpretation is:

-32768 to -32000 / pre-defined errors: These error-codes and their meanings are defined by the JSON-RPC 2.0 specification.
-32099 to -32000 / implementation-defined server-errors: These error-codes can be used for JSON-RPC 2.0 servers/frameworks/libraries for their own errors (e.g. if the JSON-RPC-server itself fails).
all other codes (>-32000 or <-32768) / application defined errors: These can freely be used by procedures which are called via JSON-RPC.
Hope this helps.
If you have any more questions about JSON-RPC, please mail me or write a mail to the JSON-RPC mailinglist
[email protected].


Reply to this email directly or view it on GitHub.

from zendframework.

Loxrie avatar Loxrie commented on June 1, 2024

Over a year later and nobody has re-opened this bug?

from zendframework.

Ocramius avatar Ocramius commented on June 1, 2024

@Loxrie open a PR with a failing test case

from zendframework.

Loxrie avatar Loxrie commented on June 1, 2024

** And I've just read the source code, it's actually resolved... this becomes painfully obvious when comparing Zend/Json/Server/Error.php between ZF2 and ZF1, where the bug still exists. **

from zendframework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.