Skip Menu |

This queue is for tickets about the MediaWiki-API CPAN distribution.

Report information
The Basics
Id: 66649
Status: rejected
Priority: 0/
Queue: MediaWiki-API

People
Owner: Nobody in particular
Requestors: dan.bolser [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.35
Fixed in: (no value)



Subject: Failed to decode JSON returned by http://www.proteopedia.org/wiki/api.php
Un-handled-ish error... The error code get set, but it fails to parse somewhere along the line... i.e. it should be cleaner: Perhaps these guys modified the default 'no api' string? Error code: 2 DETAILS: Failed to decode JSON returned by http://www.proteopedia.org/wiki/api.php Decoding Error: malformed JSON string, neither array, object, number, string or atom, at character offset 9 (before "MediaWiki API is not...") at /home/dmb/perl5/lib/perl5/MediaWiki/API.pm line 368. Returned Data: MediaWiki API is not enabled for this site. Add the following line to your LocalSettings.php<pre><b>$wgEnableAPI=true;</b></pre>
On Tue Mar 15 21:10:12 2011, dan.bolser wrote: Show quoted text
> Un-handled-ish error... The error code get set, but it fails to parse > somewhere along the line... i.e. it should be cleaner: > > Perhaps these guys modified the default 'no api' string? > > > Error code: 2 > DETAILS: > Failed to decode JSON returned by http://www.proteopedia.org/wiki/api.php > Decoding Error: > malformed JSON string, neither array, object, number, string or atom, at > character offset 9 (before "MediaWiki API is not...") at > /home/dmb/perl5/lib/perl5/MediaWiki/API.pm line 368.
There is no error. here. No JSON is returned because they have the API switched off. its quite clear from the returned data why and an error gets set accordingly.
From: dan.bolser [...] gmail.com
On Tue Mar 15 21:24:53 2011, exobuzz wrote: Show quoted text
> On Tue Mar 15 21:10:12 2011, dan.bolser wrote:
> > Un-handled-ish error... The error code get set, but it fails to parse > > somewhere along the line... i.e. it should be cleaner: > > > > Perhaps these guys modified the default 'no api' string? > > > > > > Error code: 2 > > DETAILS: > > Failed to decode JSON returned by
http://www.proteopedia.org/wiki/api.php Show quoted text
> > Decoding Error: > > malformed JSON string, neither array, object, number, string or atom, at > > character offset 9 (before "MediaWiki API is not...") at > > /home/dmb/perl5/lib/perl5/MediaWiki/API.pm line 368.
Sorry! What was confusing me here is the additional Decoding Error that is thrown by MediaWiki/API.pm. I agree, it's obvious what is going on, it just doesn't seem like this (presumably common) case is being handled very elegantly by the code. Show quoted text
> There is no error. here. No JSON is returned because they have the API > switched off. its quite clear from the returned data why and an error > gets set accordingly.
Show quoted text
> Sorry! What was confusing me here is the additional Decoding Error that > is thrown by MediaWiki/API.pm. I agree, it's obvious what is going on, > it just doesn't seem like this (presumably common) case is being handled > very elegantly by the code.
the only way to handle it would be to do string matching on the returned text. as mediawiki may well change this at some point, id rather not do string matching - it gives an error code and the text returned, so it's not a problem to deal with it in your code and I think it is better to handle it that way. As I don't believe there is a "bug" here to fix I'm marking this as rejected. Cheers.