UNPKG

5.36 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../pages/_error.tsx"],"names":["statusCodes","_getInitialProps","res","err","statusCode","Error","React","Component","render","props","title","styles","error","__html","h1","desc","h2","displayName","getInitialProps","origGetInitialProps","color","background","fontFamily","height","textAlign","display","flexDirection","alignItems","justifyContent","lineHeight","verticalAlign","borderRight","margin","marginRight","padding","fontSize","fontWeight"],"mappings":"+IAAA,oDACA,qEAGA,KAAMA,CAAAA,WAAuC,CAAG,CAC9C,IAAK,aADyC,CAE9C,IAAK,8BAFyC,CAG9C,IAAK,oBAHyC,CAI9C,IAAK,uBAJyC,CAAhD,CAYA,QAASC,CAAAA,gBAAT,CAA0B,CACxBC,GADwB,CAExBC,GAFwB,CAA1B,CAGsD,CACpD,KAAMC,CAAAA,UAAU,CACdF,GAAG,EAAIA,GAAG,CAACE,UAAX,CAAwBF,GAAG,CAACE,UAA5B,CAAyCD,GAAG,CAAGA,GAAG,CAACC,UAAP,CAAqB,GADnE,CAEA,MAAO,CAAEA,UAAF,CAAP,CACD,CAED;AACA;AACA,GACe,KAAMC,CAAAA,KAAN,QAA4BC,gBAAMC,SAA0B,CAMzEC,MAAM,EAAG,CACP,KAAM,CAAEJ,UAAF,EAAiB,KAAKK,KAA5B,CACA,KAAMC,CAAAA,KAAK,CACT,KAAKD,KAAL,CAAWC,KAAX,EACAV,WAAW,CAACI,UAAD,CADX,EAEA,kCAHF,CAKA,mBACE,oCAAK,KAAK,CAAEO,MAAM,CAACC,KAAnB,eACE,6BAAC,aAAD,mBACE,0CACGR,UAAU,CACN,GAAEA,UAAW,KAAIM,KAAM,EADjB,CAEP,yDAHN,CADF,CADF,cAQE,qDACE,sCAAO,uBAAuB,CAAE,CAAEG,MAAM,CAAE,oBAAV,CAAhC,EADF,CAEGT,UAAU,cAAG,mCAAI,KAAK,CAAEO,MAAM,CAACG,EAAlB,EAAuBV,UAAvB,CAAH,CAA6C,IAF1D,cAGE,oCAAK,KAAK,CAAEO,MAAM,CAACI,IAAnB,eACE,mCAAI,KAAK,CAAEJ,MAAM,CAACK,EAAlB,EACG,KAAKP,KAAL,CAAWC,KAAX,EAAoBN,UAApB,CACCM,KADD,cAGC,mIAEE,kCAAG,IAAI,CAAC,iEAAR,uBAFF,KAJJ,KADF,CAHF,CARF,CADF,CA+BD,CA5CwE,C,sBAAtDL,K,CACZY,W,CAAc,W,CADFZ,K,CAGZa,e,CAAkBjB,gB,CAHNI,K,CAIZc,mB,CAAsBlB,gB,CA2C/B,KAAMU,CAAAA,MAA4C,CAAG,CACnDC,KAAK,CAAE,CACLQ,KAAK,CAAE,MADF,CAELC,UAAU,CAAE,MAFP,CAGLC,UAAU,CACR,2HAJG,CAKLC,MAAM,CAAE,OALH,CAMLC,SAAS,CAAE,QANN,CAOLC,OAAO,CAAE,MAPJ,CAQLC,aAAa,CAAE,QARV,CASLC,UAAU,CAAE,QATP,CAULC,cAAc,CAAE,QAVX,CAD4C,CAcnDb,IAAI,CAAE,CACJU,OAAO,CAAE,cADL,CAEJD,SAAS,CAAE,MAFP,CAGJK,UAAU,CAAE,MAHR,CAIJN,MAAM,CAAE,MAJJ,CAKJO,aAAa,CAAE,QALX,CAd6C,CAsBnDhB,EAAE,CAAE,CACFW,OAAO,CAAE,cADP,CAEFM,WAAW,CAAE,4BAFX,CAGFC,MAAM,CAAE,CAHN,CAIFC,WAAW,CAAE,MAJX,CAKFC,OAAO,CAAE,kBALP,CAMFC,QAAQ,CAAE,MANR,CAOFC,UAAU,CAAE,GAPV,CAQFN,aAAa,CAAE,KARb,CAtB+C,CAiCnDd,EAAE,CAAE,CACFmB,QAAQ,CAAE,MADR,CAEFC,UAAU,CAAE,QAFV,CAGFP,UAAU,CAAE,SAHV,CAIFG,MAAM,CAAE,CAJN,CAKFE,OAAO,CAAE,CALP,CAjC+C,CAArD","sourcesContent":["import React from 'react'\nimport Head from '../next-server/lib/head'\nimport { NextPageContext } from '../next-server/lib/utils'\n\nconst statusCodes: { [code: number]: string } = {\n 400: 'Bad Request',\n 404: 'This page could not be found',\n 405: 'Method Not Allowed',\n 500: 'Internal Server Error',\n}\n\nexport type ErrorProps = {\n statusCode: number\n title?: string\n}\n\nfunction _getInitialProps({\n res,\n err,\n}: NextPageContext): Promise<ErrorProps> | ErrorProps {\n const statusCode =\n res && res.statusCode ? res.statusCode : err ? err.statusCode! : 404\n return { statusCode }\n}\n\n/**\n * `Error` component used for handling errors.\n */\nexport default class Error<P = {}> extends React.Component<P & ErrorProps> {\n static displayName = 'ErrorPage'\n\n static getInitialProps = _getInitialProps\n static origGetInitialProps = _getInitialProps\n\n render() {\n const { statusCode } = this.props\n const title =\n this.props.title ||\n statusCodes[statusCode] ||\n 'An unexpected error has occurred'\n\n return (\n <div style={styles.error}>\n <Head>\n <title>\n {statusCode\n ? `${statusCode}: ${title}`\n : 'Application error: a client-side exception has occurred'}\n </title>\n </Head>\n <div>\n <style dangerouslySetInnerHTML={{ __html: 'body { margin: 0 }' }} />\n {statusCode ? <h1 style={styles.h1}>{statusCode}</h1> : null}\n <div style={styles.desc}>\n <h2 style={styles.h2}>\n {this.props.title || statusCode ? (\n title\n ) : (\n <>\n Application error: a client-side exception has occurred (\n <a href=\"https://nextjs.org/docs/messages/client-side-exception-occurred\">\n developer guidance\n </a>\n )\n </>\n )}\n .\n </h2>\n </div>\n </div>\n </div>\n )\n }\n}\n\nconst styles: { [k: string]: React.CSSProperties } = {\n error: {\n color: '#000',\n background: '#fff',\n fontFamily:\n '-apple-system, BlinkMacSystemFont, Roboto, \"Segoe UI\", \"Fira Sans\", Avenir, \"Helvetica Neue\", \"Lucida Grande\", sans-serif',\n height: '100vh',\n textAlign: 'center',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n },\n\n desc: {\n display: 'inline-block',\n textAlign: 'left',\n lineHeight: '49px',\n height: '49px',\n verticalAlign: 'middle',\n },\n\n h1: {\n display: 'inline-block',\n borderRight: '1px solid rgba(0, 0, 0,.3)',\n margin: 0,\n marginRight: '20px',\n padding: '10px 23px 10px 0',\n fontSize: '24px',\n fontWeight: 500,\n verticalAlign: 'top',\n },\n\n h2: {\n fontSize: '14px',\n fontWeight: 'normal',\n lineHeight: 'inherit',\n margin: 0,\n padding: 0,\n },\n}\n"]}
\No newline at end of file