-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure error is passed up in minimal mode
- Loading branch information
Showing
5 changed files
with
109 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
test/integration/required-server-files/pages/errors/gip.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function Page(props) { | ||
return <p>here comes an error</p> | ||
} | ||
|
||
Page.getInitialProps = ({ query }) => { | ||
if (query.crash) { | ||
throw new Error('gip hit an oops') | ||
} | ||
return { | ||
hello: 'world', | ||
} | ||
} | ||
|
||
export default Page |
28 changes: 28 additions & 0 deletions
28
test/integration/required-server-files/pages/errors/gsp/[post].js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { useRouter } from 'next/router' | ||
|
||
function Page(props) { | ||
if (useRouter().isFallback) { | ||
return <p>loading...</p> | ||
} | ||
return <p>here comes an error</p> | ||
} | ||
|
||
export const getStaticPaths = () => { | ||
return { | ||
paths: [], | ||
fallback: true, | ||
} | ||
} | ||
|
||
export const getStaticProps = ({ params }) => { | ||
if (params.post === 'crash') { | ||
throw new Error('gsp hit an oops') | ||
} | ||
return { | ||
props: { | ||
hello: 'world', | ||
}, | ||
} | ||
} | ||
|
||
export default Page |
16 changes: 16 additions & 0 deletions
16
test/integration/required-server-files/pages/errors/gssp.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
function Page(props) { | ||
return <p>here comes an error</p> | ||
} | ||
|
||
export const getServerSideProps = ({ query }) => { | ||
if (query.crash) { | ||
throw new Error('gssp hit an oops') | ||
} | ||
return { | ||
props: { | ||
hello: 'world', | ||
}, | ||
} | ||
} | ||
|
||
export default Page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters