Skip to content

Commit

Permalink
Merge pull request #39 from arbs-io/feature/20230405-SimplifyDetectin…
Browse files Browse the repository at this point in the history
…gIssues

Feature/20230405 simplify detecting issues
  • Loading branch information
arbs-io authored Apr 6, 2023
2 parents 990fffe + fffa48e commit 1ca440c
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 25 deletions.
36 changes: 15 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,32 +70,26 @@ Overall, vscode-openai is a valuable tool for developers who want to improve the

# Detecting Issues

### Not Found
### Not Found ![vscode-openai-vscode-codicons-cloud.png](images/vscode-openai-vscode-codicons-cloud.png)

This error occurs if any of the configuration parameters are incorrect. Please check the following:
- Message: "**vscode-openai.openai.azure.com - not found**"
- Description: This error occurs if any of the configuration parameters are incorrect. Please check the following:
- OpenAI:
- The version (e.g. /v1) is present on the base url.
- Azure: Check you have:
- The openai segment (e.g. /openai) is on the base url.
- The api-version is valid and is available in your region.
- The deployment name is correct.

- OpenAI:
- The version (e.g. /v1) is present on the base url.
- Azure: Check you have:
- The openai segment (e.g. /openai) is on the base url.
- The api-version is valid and is available in your region.
- The deployment name is correct.
### Authentication Issue ![vscode-openai-vscode-codicons-lock.png](images/vscode-openai-vscode-codicons-lock.png)

If any of these values are incorrect, the following error will be displayed.
- Message: "**vscode-openai.openai.azure.com - failed authentication**"
- Description: This error occurs if your Api-Key is invalid. Check the Api-Key is valid for the instance or has expired

![vscode-openai-error-notfound.png](images/vscode-openai-error-notfound.png)
### Unknown Host ![vscode-openai-vscode-codicons-server-environment.png](images/vscode-openai-vscode-codicons-server-environment.png)

### Authentication Issue

If your Api-Key is invalid, the following error will be displayed

![vscode-openai-error-failedauthentication.png](images/vscode-openai-error-failedauthentication.png)

### Unknown Host

The host is not found. Either your Azure instance or your Api-Gateway URL can't be resolved. The following error will be displayed.

![vscode-openai-error-unknownhost.png](images/vscode-openai-error-unknownhost.png)
- Message: "**vscode-openai1.openai.azure.com - unknown host**"
- Description: This error occurs if the host is not found. Either your Azure instance or your Api-Gateway URL can't be resolved. The following error will be displayed.

# Configuring Azure

Expand Down
Binary file removed images/vscode-openai-error-failedauthentication.png
Binary file not shown.
Binary file removed images/vscode-openai-error-notfound.png
Binary file not shown.
Binary file removed images/vscode-openai-error-unknownhost.png
Binary file not shown.
Binary file added images/vscode-openai-vscode-codicons-cloud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/vscode-openai-vscode-codicons-lock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-openai",
"displayName": "vscode-openai",
"description": "A vscode extension can significantly enhance your productivity and efficiency when developing complex software applications using OpenAI latest models",
"version": "1.0.12",
"version": "1.0.13",
"publisher": "AndrewButson",
"icon": "images/logo_128x128.png",
"private": true,
Expand Down
7 changes: 4 additions & 3 deletions src/openaiUtilities/api/errorHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ import { ExtensionStatusBarItem } from '../../vscodeUtilities'
import { showMessageWithTimeout } from '../../vscodeUtilities'

export function errorHandler(error: any) {
//Always disable extension when exception occurs
commands.executeCommand('setContext', 'vscode-openai.context.apikey', false)

if (error.syscall === 'getaddrinfo' && error.errno === -3008) {
ExtensionStatusBarItem.instance.showStatusBarError(
'server-environment',
'- unknown host'
)
// disable extension when exception occurs
commands.executeCommand('setContext', 'vscode-openai.context.apikey', false)
} else if (error.response !== undefined && error.response.status === 401) {
ExtensionStatusBarItem.instance.showStatusBarError(
'lock',
'- failed authentication'
)
// disable extension when exception occurs
commands.executeCommand('setContext', 'vscode-openai.context.apikey', false)
} else if (error.response !== undefined && error.response.status === 404) {
ExtensionStatusBarItem.instance.showStatusBarError('cloud', '- not found')
showMessageWithTimeout(
Expand Down

0 comments on commit 1ca440c

Please sign in to comment.