mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-19 15:29:42 +01:00
Add sendJsonError
This commit is contained in:
parent
fcc857a734
commit
c87f0c47cd
@ -514,3 +514,14 @@ Api_v1::apiCallFailed( QxtWebRequestEvent* event, const QString& method )
|
||||
{
|
||||
sendPlain404( event, QString( "Method \"%1\" for API 1.5 not found" ).arg( method ), "Method in API 1.5 not found" );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Api_v1::sendJsonError( QxtWebRequestEvent* event, const QString& message )
|
||||
{
|
||||
QxtWebPageEvent * e = new QxtWebPageEvent( event->sessionID, event->requestID, QString( "{ result: \"error\", error: \"%1\" }" ).arg( message ).toUtf8().constData() );
|
||||
e->contentType = "application/json";
|
||||
e->status = 500;
|
||||
e->statusMessage = "Method call failed.";
|
||||
postEvent( e );
|
||||
}
|
||||
|
@ -82,6 +82,7 @@ public slots:
|
||||
|
||||
// load an html template from a file, replace args from map
|
||||
// then serve
|
||||
void sendJsonError( QxtWebRequestEvent* event, const QString& message );
|
||||
void sendWebpageWithArgs( QxtWebRequestEvent* event, const QString& filenameSource, const QHash< QString, QString >& args );
|
||||
|
||||
void index( QxtWebRequestEvent* event );
|
||||
|
Loading…
x
Reference in New Issue
Block a user