tangled
alpha
login
or
join now
tynanpurdy.com
/
atprofile
3
fork
atom
Fork of atp.tools as a universal profile for people on the ATmosphere
3
fork
atom
overview
issues
pulls
pipelines
more descriptive errors when we can't find docs
Natalie B.
11 months ago
37f5991e
ffb1cbdb
+36
-7
4 changed files
expand all
collapse all
unified
split
src
components
error.tsx
routes
at:
$handle
$collection.$rkey.lazy.tsx
$collection.index.lazy.tsx
$handle.index.tsx
+1
-1
src/components/error.tsx
···
10
10
<div className="flex flex-col gap-2 items-center">
11
11
<CircleAlert className="text-red-500" width={48} height={48} />
12
12
<div className="h-min text-wrap break-words max-w-md w-full text-center">
13
13
-
Error: {error.message}
13
13
+
{error.message}
14
14
</div>
15
15
</div>
16
16
<div className="flex flex-row gap-2 items-center">
+14
-2
src/routes/at:/$handle.index.tsx
···
51
51
try {
52
52
setState((prev) => ({ ...prev, isLoading: true }));
53
53
54
54
-
const id = await resolveFromIdentity(handle);
54
54
+
let id;
55
55
+
try {
56
56
+
id = await resolveFromIdentity(handle);
57
57
+
} catch (err: any) {
58
58
+
console.log("BSLKDJFSL");
59
59
+
throw new Error("Unable to resolve identity: " + err.message);
60
60
+
}
55
61
// we dont use the main authenticated client here
56
62
const rpc = new QtClient(id.identity.pds);
57
63
// get the PDS
···
61
67
params: { repo: id.identity.id },
62
68
signal: abortController.signal,
63
69
});
64
64
-
let doc = await getDidDoc(id.identity.id);
70
70
+
let doc;
71
71
+
try {
72
72
+
doc = await getDidDoc(id.identity.id);
73
73
+
} catch (error) {
74
74
+
console.log("sdf");
75
75
+
console.error("Failed to fetch DID document:", error);
76
76
+
}
65
77
// can we get bsky data?
66
78
if (response.data.collections.includes("app.bsky.actor.profile")) {
67
79
// reuse client dumbass
+10
-2
src/routes/at:/$handle/$collection.$rkey.lazy.tsx
···
47
47
try {
48
48
setState((prev) => ({ ...prev, isLoading: true }));
49
49
50
50
-
const id = await resolveFromIdentity(handle);
50
50
+
let id;
51
51
+
try {
52
52
+
id = await resolveFromIdentity(handle);
53
53
+
} catch (err: any) {
54
54
+
throw new Error("Unable to resolve identity: " + err.message);
55
55
+
}
51
56
// we dont use the main authenticated client here
52
57
const rpc = new QtClient(id.identity.pds);
53
58
// get the PDS
···
78
83
setState({
79
84
data: undefined,
80
85
isLoading: false,
81
81
-
error: err instanceof Error ? err : new Error("An error occurred"),
86
86
+
error:
87
87
+
err instanceof Error
88
88
+
? err
89
89
+
: new Error("Unable to resolve identity: " + err.message),
82
90
});
83
91
}
84
92
}
+11
-2
src/routes/at:/$handle/$collection.index.lazy.tsx
···
39
39
40
40
setState((prev) => ({ ...prev, isLoading: true }));
41
41
42
42
-
const id = await resolveFromIdentity(handle);
42
42
+
let id;
43
43
+
try {
44
44
+
id = await resolveFromIdentity(handle);
45
45
+
} catch (err: any) {
46
46
+
console.log("BSLKDJFSL");
47
47
+
throw new Error("Unable to resolve identity: " + err.message);
48
48
+
}
43
49
const rpc = new QtClient(id.identity.pds);
44
50
45
51
const response = await rpc
···
67
73
setState((prev) => ({
68
74
...prev,
69
75
isLoading: false,
70
70
-
error: err instanceof Error ? err : new Error("An error occurred"),
76
76
+
error:
77
77
+
err instanceof Error
78
78
+
? err
79
79
+
: new Error("Unable to resolve identity: " + err.message),
71
80
}));
72
81
}
73
82
}