Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
1// These are guards that are used throughout the codebase to warn or error on
2// unexpected behaviour or conditions.
3// Every warning and error comes with a number that uniquely identifies them.
4// You can read more about the messages themselves in `docs/graphcache/errors.md`
5export type ErrorCode =
6 | 1
7 | 2
8 | 3
9 | 4
10 | 5
11 | 6
12 | 7
13 | 8
14 | 9
15 | 10
16 | 11
17 | 12
18 | 13
19 | 15
20 | 16
21 | 17
22 | 18
23 | 19;
24
25// URL unfurls to https://formidable.com/open-source/urql/docs/graphcache/errors/
26const helpUrl = '\nhttps://bit.ly/2XbVrpR#';
27const cache = new Set<string>();
28
29export function warn(message: string, code: ErrorCode) {
30 if (!cache.has(message)) {
31 console.warn(message + helpUrl + code);
32 cache.add(message);
33 }
34}