Error response when MAL list is empty.

Issue #2 resolved
Ratan Dhawtal created an issue

If Mal does respond nothing (My mangalist doesn't contain anything) the api will respond an error code.

See error.txt for the response.

Comments (6)

  1. Michael Johnson

    Yep. We'll need to detect an invalid response and return proper errors. I was thinking of creating some exceptions we can use to send data back to the controller without relying on strings and having to then check the return value before passing it to the view.

  2. Ratan Dhawtal reporter

    I was checking stuff while you were busy.

    }elseif (strpos($animelistcontent,'<anime>') == false){

    If the file doesn't contain <anime> (Only occurrence if we have no records). We can use this code above if you are okay with it?

    We can place it before [else]:

    if (strpos($animelistcontent,'Invalid username') !== false){ $animelist = 'Failed to find the specified user, please try again.'; }else{ $animelistxml = new SimpleXMLElement($animelistcontent);

  3. Michael Johnson

    For the lists, it should just return an empty array, and that's what it seems to do for mangalist and animelist. (Ruby one returns an empty list, we currently return null.)

    What action are we having issues on?

  4. Michael Johnson

    Checked and the error is reported back only in the dev environment. Production suppresses the error and just causes a null return.

    We will need to implement handling for both animelist and mangalist. I'll work on this later.

  5. Michael Johnson

    Initialize Arrays for Manga/Anime Lists

    Set up the $alist and $mlist variables in the controllers. This avoids having a null object when we add it to our output later on.

    Fixes #2

    → <<cset 51143734809a>>

  6. Log in to comment