Skip to content

Instantly share code, notes, and snippets.

@fgilio
fgilio / axios-catch-error.js
Last active April 11, 2024 19:02
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@craigbeck
craigbeck / introspection-query.graphql
Created April 6, 2016 20:20
Introspection query for GraphQL
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
@vasildakov-zz
vasildakov-zz / Module.php
Last active November 21, 2021 05:32
ZF2 and Doctrine Entity listeners resolver
<?php
namespace Application;
class Module
{
public function onBootstrap(MvcEvent $e)
{
$application = $e->getTarget();
$serviceManager = $application->getServiceManager();
$sharedManager = $application->getEventManager()->getSharedManager();