Coder Social home page Coder Social logo

wordnik-php's People

Contributors

emckean avatar fehguy avatar kflorence avatar zeke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wordnik-php's Issues

The examples has various strange characters

The examples of the words contains unknown characters due to which I am not able to use json_decode over it. Please remove those characters as I have even tried many patterns in preg_replace. Still no success.
The json_last_error is returning "4" as error while using json_decode.

Wordnik Api

Hi! I've been trying to get an API key for the last few days. I keep seeing that it is supposed to be at the bottom of the settings page but it shows . Here is a picture of what my account looks like. Your API key is: Your API key is not yet available. Check back in a few days. Please help!

issue regarding obtaining apikey

I've been trying to get API key for past 2 days but I couldn't. I've created account of wordnik.com and also signedup for apikey at developer.wordsapi.com but yet nothing. PLS help ASAP

AccountApi#authenticate method throws too-ambiguous Exception

Throwing an exception using the generic "Exception" class is not best practice. It's counter intuitive in the following way:

When implementing the API, we have to wrap this in a try/catch block like so:

// Attempt Wordnik API authentication.
try {
    $authResponse = $this->wordnik->authenticate($username, $token->getPassword());
} catch(\Exception $errorResponse) {
    $errorMessage = $errorResponse->getMessage();
    // ...
}

However by catching "Exception", we may end up catching Exceptions we didn't intend to catch, preventing other Exceptions from coming to light, and causing new problems in our catch clause.

For example: What if $token->getPassword() produces an exception? This will also be caught by my try/catch block, however my catch block was written to anticipate the specific use of the Exception class coming from ApiAccount#authenticate, and now an Exception might occur in my catch block. I just experienced this exact issue.

The solution to this problem is to create custom, Swagger-specific Exception classes, i.e. in this case SwaggerApiAuthenticationException. Then my try/catch block could target this specific Exception, and I wouldn't, as they say, catch 'em all.

I know that the API is Swagger-generated so I won't fork the repository or submit a patch. However it would be ideal if Swagger was able to generate PHP API wrappers which defined and implemented custom exceptions.

EDIT:

This problem also effects timeout issues. When there's a timeout on the request, an Exception gets thrown, but aside from inspecting the Exception's error message, I have no way of knowing that the user didn't supply an incorrect password. This is because the Exceptions all have the same class, and none of them have error codes, so there's no real way to distinguish what the problem was.

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.