async function handleCreate()

in source/routing-configurer/state-updater.ts [14:32]


async function handleCreate(props: IStateUpdaterProperties): Promise<CompletionStatus> {
    try {
        if (!props.TableName) { throw new Error('TableName was not supplied'); }
        if (!props.AppId) { throw new Error('AppId was not supplied'); }
        if (!props.NewState) { throw new Error('NewState was not supplied'); }

        await updateState(props.TableName, props.AppId, props.NewState);
        return {
            Status: StatusTypes.Success,
            Data: { Message: `Successfully updated ${props.TableName} and set appId (${props.AppId}) to ${props.NewState}` }
        }
    } catch (error) {
        console.error(error);
        return {
            Status: StatusTypes.Failed,
            Data: { Message: error.message }
        }
    }
}