{/* Start Typescript Errors */}
All SDK methods return a response object or throw an error. If Error objects are specified in your OpenAPI Spec, the SDK will throw the appropriate Error type.



Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted string since validation errors can list many issues and the plain error string may be difficult read when debugging. 


```typescript
import { PlexAPI } from "@lukehagar/plexjs";
import * as errors from "@lukehagar/plexjs/models/errors";

async function run() {
    const sdk = new PlexAPI({
        accessToken: "<YOUR_API_KEY_HERE>",
        xPlexClientIdentifier: "<value>",
    });

    let result;
    try {
        result = await sdk.server.getServerCapabilities();
    } catch (err) {
        switch (true) {
            case err instanceof errors.SDKValidationError: {
                // Validation errors can be pretty-printed
                console.error(err.pretty());
                // Raw value may also be inspected
                console.error(err.rawValue);
                return;
            }
            case err instanceof errors.GetServerCapabilitiesResponseBody: {
                console.error(err); // handle exception
                return;
            }
            default: {
                throw err;
            }
        }
    }

    // Handle the result
    console.log(result);
}

run();

```
{/* End Typescript Errors */}
