File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -26,12 +26,16 @@ export default class AsyncHttpContext {
2626 return new Proxy ( this , proxyHandler )
2727 }
2828
29- public runSyncAndReturn ( context , next ) {
30- return this . $context . runSyncAndReturn ( context , next )
29+ public run ( context , next ) {
30+ return this . $context . run ( context , next )
3131 }
3232
3333 public get context ( ) {
34- return this . $context . getStore ( ) || { }
34+ const store = this . $context . getStore ( )
35+ if ( store === undefined ) {
36+ throw new Error ( 'AsyncHttpContext cannot be used outside of a request context' )
37+ }
38+ return store ;
3539 }
3640}
3741
Original file line number Diff line number Diff line change @@ -5,6 +5,6 @@ export default class AsyncHttpContextMiddleware {
55 }
66
77 public async handle ( ctx : HttpContextContract , next : ( ) => Promise < void > ) {
8- return this . $context . runSyncAndReturn ( ctx , next )
8+ return this . $context . run ( ctx , next )
99 }
1010}
You can’t perform that action at this time.
0 commit comments