File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 2121 ? "Missing token or username in config. Check Contributing.md for details. "
2222 : ".env was not found. Check Contributing.md for details. " ;
2323
24+ if ($ requestedType === "json " ) {
25+ // set content type to JSON
26+ header ('Content-Type: application/json ' );
27+ // echo JSON error message
28+ echo json_encode (array ("error " => $ message ));
29+ exit ;
30+ }
31+
2432 $ card = generateErrorCard ($ message );
2533 if ($ requestedType === "png " ) {
2634 echoAsPng ($ card );
5058 $ contributions = getContributionDates ($ contributionGraphs );
5159 $ stats = getContributionStats ($ contributions );
5260} catch (InvalidArgumentException $ error ) {
61+ if ($ requestedType === "json " ) {
62+ // set content type to JSON
63+ header ('Content-Type: application/json ' );
64+ // echo JSON error message
65+ echo json_encode (array ("error " => $ error ->getMessage ()));
66+ exit ;
67+ }
5368 $ card = generateErrorCard ($ error ->getMessage ());
5469 if ($ requestedType === "png " ) {
5570 echoAsPng ($ card );
You can’t perform that action at this time.
0 commit comments