35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
const generateMessage = (path, cursorValue) => `The cursor at "${path.join(
|
|
","
|
|
)}" did not change its value "${cursorValue}" after a page transition. Please make sure your that your query is set up correctly.`;
|
|
class MissingCursorChange extends Error {
|
|
constructor(pageInfo, cursorValue) {
|
|
super(generateMessage(pageInfo.pathInQuery, cursorValue));
|
|
this.pageInfo = pageInfo;
|
|
this.cursorValue = cursorValue;
|
|
if (Error.captureStackTrace) {
|
|
Error.captureStackTrace(this, this.constructor);
|
|
}
|
|
}
|
|
name = "MissingCursorChangeError";
|
|
}
|
|
class MissingPageInfo extends Error {
|
|
constructor(response) {
|
|
super(
|
|
`No pageInfo property found in response. Please make sure to specify the pageInfo in your query. Response-Data: ${JSON.stringify(
|
|
response,
|
|
null,
|
|
2
|
|
)}`
|
|
);
|
|
this.response = response;
|
|
if (Error.captureStackTrace) {
|
|
Error.captureStackTrace(this, this.constructor);
|
|
}
|
|
}
|
|
name = "MissingPageInfo";
|
|
}
|
|
export {
|
|
MissingCursorChange,
|
|
MissingPageInfo
|
|
};
|