I am running a request to the youtube data api.
The user inputs there account name, saves the settings and then checks the page for what videos are on there account -
If they enter their account name wrong, or the account name doesn't exist I want it to display an error message clarifying that they have entered an incorrect account name.
If it is successful it should just print the videos in a list.
I have it printing videos/pulling videos from youtube if the account name is correct. If it is wrong, I get a File_Get_Contents failed -
Warning: file_get_contents(http://gdata.youtube.com/feeds/api/users/ddd/uploads?
v=2&alt=json): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
in C:\xampp\htdocs\site\wp-content\plugins\plugin\includes\get_vid_list.php on
line 379
I would like, instead of printing the error I want it to print an error message to the user:
How do I check if file_get_contents() was successful or not?
Use PHP's # modifier to suppress automatic error reporting:
$contents = #file_get_contents($url);
if (!$contents) {
// Report error
}
Related
I have an express js project that has a try catch, when i respond with status code 500 i get no error detail returned.
Below you can see that when i return status code 200 i get a full response with the error and in this case 'Invalid time value'.
But when i change to status code 500 i get hardly any information, how do i send status code 500 but still get full error information?
this output is normal based on Hypertext Transfer Protocol, you can check the details about status codes here.
when status code is 200
The request has succeeded. The information returned with the response
is dependent on the method used in the request, for example:
GET an entity corresponding to the requested resource is sent in
the response;
HEAD the entity-header fields corresponding to the requested
resource are sent in the response without any message-body;
POST an entity describing or containing the result of the action;
TRACE an entity containing the request message as received by the
end server.
when status code is 500
500 Internal Server Error
The server encountered an unexpected condition which prevented it
from fulfilling the request
this outputs is Hypertext Transfer Protocol and its normal
I am trying to connect my app to Azure's Custom Vision API using the predict_image method of the predictor object(as seen in their tutorial). However it is giving me the following error: "Operation returned an invalid status code 'Not Found' ".
Screenshots Attached: Error Message Actual Code
Is there a default iteration set for the project? If the prediction endpoint is called without specifying an iteration id then that implicitly falls back to using the default iteration. But if there is no default iteration set then the service will respond with a 404. There should be more detail available in the response body.
Jenkins version: 2.89.4 / 2.89.4.2-rolling
I can see the login page (clicking right top Log in link). Sometime it brings the login page (where a user can enter username / password) -OR- it's taking me straight to an error.. in either case.
Error:
In the address bar, I see this URL value:
http://jenkins-dev-server:8080/securityRealm/finishLogin?code=bc2c6a5a-b898-4a6b-96h7-e7jhcba59ytg
An error occurred processing your request. Ask your Jenkins administrator to look up details. ErrorID=gh425da7-0y78-4068-b2h9-c2bed48ke6sa
Stack trace suppressed by the suppress stack trace plugin
One of the job's status before this happened was showing FAILED (Red ball) but looking into the job's console output shows NO "error|failed|fail|aborted|fatal|memory" related errors (case in-sensitive). The last line in the console output is just a valid expected output (for ex: echo "hello world") nothing after that.
So it seems like, Jenkins home's mount (df -kvh ${JENKINS_HOME}) was 100% full. I know! new to the team.
Will implement some good monitoring as soon as I get some elevated
access.
I have received the following error when trying to save a DSX Scheduled Job:
Job schedule entry could not be created. Status code: 500
Screenshot of the error message:
I've tried about six times over the last few hours and have consistently received the above error message.
Debugging via the browser network inspection tool I can see:
{
"code":"CDSX.N.1001",
"message":"The service is not responding, try again later.",
"description":"",
"httpMethod":"POST",
"url":"https://batch-schedule-prod.spark.bluemix.net:12100/schedules",
"qs":"",
"body":"While attempting to get Bluemix Token from BlueIDToken, unable to retrieve AccessToken, failed with status 400 Bad Request, message = {\"error\":\"invalid_grant\",\"error_description\":\"A redirect_uri can only be used by implicit or authorization_code grant types.\"} Entity: {\"error\":\"invalid_grant\",\"error_description\":\"A redirect_uri can only be used by implicit or authorization_code grant types.\"}",
"statusCode":500,
"duration":666,
"expectedStatusCode":201
}
As per Charles comment, the functionality is working ok now. I guess if this happens to another user some time in the future they should contact support.
According to documentation when trial is expired and user opens the app, a message would be shown. But my app closes after showing splash screen without any message in this case.
There is the same question on the Microsoft's forum, but I can't write anything there (it returns me unexpected error when I try to submit my question) and there is no answer.
I get the following line in my event log:
App failed with error: No applicable app licenses found. See the Microsoft-Windows-Twin/Operational log for additional information.
Additional information:
< Data Name="ErrorCode" >-1058406399< /Data >
This is Microsoft's bug and they promise to fix it. You can get more details on the msdn-forum.