Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix: better error state

liyasthomas78ad61f15321
diff --git a/packages/hoppscotch-app/components/http/CodegenModal.vue b/packages/hoppscotch-app/components/http/CodegenModal.vue
index dcafba0d7..9901aed48 100644
--- a/packages/hoppscotch-app/components/http/CodegenModal.vue
+++ b/packages/hoppscotch-app/components/http/CodegenModal.vue
@@ -54,7 +54,7 @@
</label>
</div>
<div
- v-if="!requestCode"
+ v-if="errorState"
class="bg-primaryLight rounded font-mono w-full py-2 px-4 text-red-400 overflow-auto whitespace-normal"
>
{{ t("error.something_went_wrong") }}
@@ -114,6 +114,7 @@ const options = ref<any | null>(null)
const request = ref(getRESTRequest())
const codegenType = ref<CodegenName>("shell-curl")
const copyIcon = ref("copy")
+const errorState = ref(false)
const requestCode = computed(() => {
const effectiveRequest = getEffectiveRESTRequest(
@@ -126,9 +127,10 @@ const requestCode = computed(() => {
const result = generateCode(codegenType.value, effectiveRequest)
if (O.isSome(result)) {
+ errorState.value = false
return result.value
} else {
- // TODO: Error logic?
+ errorState.value = true
return ""
}
})