mirror of
https://github.com/tooot-app/app
synced 2025-03-30 19:30:17 +02:00
Fix weird error reportings
This commit is contained in:
parent
e33e8550f6
commit
db46ccc3d8
@ -68,8 +68,8 @@ const apiGeneral = async <T = unknown>({
|
|||||||
error.response.data.error
|
error.response.data.error
|
||||||
)
|
)
|
||||||
return Promise.reject({
|
return Promise.reject({
|
||||||
status: error.response.status,
|
status: error?.response.status,
|
||||||
message: error.response.data.error
|
message: error?.response.data.error
|
||||||
})
|
})
|
||||||
} else if (error?.request) {
|
} else if (error?.request) {
|
||||||
// The request was made but no response was received
|
// The request was made but no response was received
|
||||||
|
@ -110,8 +110,8 @@ const apiInstance = async <T = unknown>({
|
|||||||
error.response.data.error
|
error.response.data.error
|
||||||
)
|
)
|
||||||
return Promise.reject({
|
return Promise.reject({
|
||||||
status: error.response.status,
|
status: error?.response.status,
|
||||||
message: error.response.data.error
|
message: error?.response.data.error
|
||||||
})
|
})
|
||||||
} else if (error?.request) {
|
} else if (error?.request) {
|
||||||
// The request was made but no response was received
|
// The request was made but no response was received
|
||||||
|
@ -66,7 +66,7 @@ const apiTooot = async <T = unknown>({
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (sentry && Math.random() < 0.1) {
|
if (sentry) {
|
||||||
Sentry.Native.setExtras({
|
Sentry.Native.setExtras({
|
||||||
API: 'tooot',
|
API: 'tooot',
|
||||||
...(error?.response && { response: error.response }),
|
...(error?.response && { response: error.response }),
|
||||||
@ -85,8 +85,8 @@ const apiTooot = async <T = unknown>({
|
|||||||
error.response.data.error
|
error.response.data.error
|
||||||
)
|
)
|
||||||
return Promise.reject({
|
return Promise.reject({
|
||||||
status: error.response.status,
|
status: error?.response.status,
|
||||||
message: error.response.data.error
|
message: error?.response.data.error
|
||||||
})
|
})
|
||||||
} else if (error?.request) {
|
} else if (error?.request) {
|
||||||
// The request was made but no response was received
|
// The request was made but no response was received
|
||||||
|
@ -49,7 +49,7 @@ const renderNode = ({
|
|||||||
const href = node.attribs.href
|
const href = node.attribs.href
|
||||||
if (classes) {
|
if (classes) {
|
||||||
if (classes.includes('hashtag')) {
|
if (classes.includes('hashtag')) {
|
||||||
const tag = href.split(new RegExp(/\/tag\/(.*)|\/tags\/(.*)/))
|
const tag = href?.split(new RegExp(/\/tag\/(.*)|\/tags\/(.*)/))
|
||||||
const differentTag = routeParams?.hashtag
|
const differentTag = routeParams?.hashtag
|
||||||
? routeParams.hashtag !== tag[1] && routeParams.hashtag !== tag[2]
|
? routeParams.hashtag !== tag[1] && routeParams.hashtag !== tag[2]
|
||||||
: true
|
: true
|
||||||
@ -107,7 +107,7 @@ const renderNode = ({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const domain = href.split(new RegExp(/:\/\/(.[^\/]+)/))
|
const domain = href?.split(new RegExp(/:\/\/(.[^\/]+)/))
|
||||||
// Need example here
|
// Need example here
|
||||||
const content =
|
const content =
|
||||||
node.children && node.children[0] && node.children[0].data
|
node.children && node.children[0] && node.children[0].data
|
||||||
@ -124,11 +124,15 @@ const renderNode = ({
|
|||||||
}}
|
}}
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
analytics('status_link_press')
|
analytics('status_link_press')
|
||||||
!disableDetails && !shouldBeTag
|
if (!disableDetails) {
|
||||||
? await openLink(href, navigation)
|
if (shouldBeTag) {
|
||||||
: navigation.push('Tab-Shared-Hashtag', {
|
navigation.push('Tab-Shared-Hashtag', {
|
||||||
hashtag: content.substring(1)
|
hashtag: content.substring(1)
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
await openLink(href, navigation)
|
||||||
|
}
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{(content && content !== href && content) ||
|
{(content && content !== href && content) ||
|
||||||
|
@ -22,7 +22,7 @@ const TimelineActioned = React.memo(
|
|||||||
const { colors } = useTheme()
|
const { colors } = useTheme()
|
||||||
const navigation =
|
const navigation =
|
||||||
useNavigation<StackNavigationProp<TabLocalStackParamList>>()
|
useNavigation<StackNavigationProp<TabLocalStackParamList>>()
|
||||||
const name = account?.display_name || account.username
|
const name = account?.display_name || account?.username
|
||||||
const iconColor = colors.primaryDefault
|
const iconColor = colors.primaryDefault
|
||||||
|
|
||||||
const content = (content: string) => (
|
const content = (content: string) => (
|
||||||
|
@ -27,7 +27,7 @@ const HeaderSharedAccount = React.memo(
|
|||||||
numberOfLines={1}
|
numberOfLines={1}
|
||||||
>
|
>
|
||||||
<ParseEmojis
|
<ParseEmojis
|
||||||
content={account?.display_name || account.username}
|
content={account?.display_name || account?.username}
|
||||||
emojis={account.emojis}
|
emojis={account.emojis}
|
||||||
fontBold
|
fontBold
|
||||||
/>
|
/>
|
||||||
|
@ -49,7 +49,7 @@ const ActionsStatus: React.FC<Props> = ({
|
|||||||
message: t('common:message.error.message', {
|
message: t('common:message.error.message', {
|
||||||
function: t(`shared.header.actions.status.${theFunction}.function`)
|
function: t(`shared.header.actions.status.${theFunction}.function`)
|
||||||
}),
|
}),
|
||||||
...(err.status &&
|
...(err?.status &&
|
||||||
typeof err.status === 'number' &&
|
typeof err.status === 'number' &&
|
||||||
err.data &&
|
err.data &&
|
||||||
err.data.error &&
|
err.data.error &&
|
||||||
|
@ -249,7 +249,7 @@ const instancesSlice = createSlice({
|
|||||||
// Update Instance Configuration
|
// Update Instance Configuration
|
||||||
.addCase(updateConfiguration.fulfilled, (state, action) => {
|
.addCase(updateConfiguration.fulfilled, (state, action) => {
|
||||||
const activeIndex = findInstanceActive(state.instances)
|
const activeIndex = findInstanceActive(state.instances)
|
||||||
state.instances[activeIndex].version = action.payload.version
|
state.instances[activeIndex].version = action.payload?.version || '0'
|
||||||
state.instances[activeIndex].configuration =
|
state.instances[activeIndex].configuration =
|
||||||
action.payload.configuration
|
action.payload.configuration
|
||||||
})
|
})
|
||||||
@ -316,7 +316,7 @@ const instancesSlice = createSlice({
|
|||||||
state.instances[activeIndex].frequentEmojis = state.instances[
|
state.instances[activeIndex].frequentEmojis = state.instances[
|
||||||
activeIndex
|
activeIndex
|
||||||
].frequentEmojis?.filter(emoji => {
|
].frequentEmojis?.filter(emoji => {
|
||||||
return action.payload.find(
|
return action.payload?.find(
|
||||||
e =>
|
e =>
|
||||||
e.shortcode === emoji.emoji.shortcode && e.url === emoji.emoji.url
|
e.shortcode === emoji.emoji.shortcode && e.url === emoji.emoji.url
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user