Function grafbase_local_backend::project::init
source · pub fn init(
name: Option<&str>,
template: Option<&str>
) -> Result<(), BackendError>Expand description
initializes a new project in the current or a new directory, optionally from a template
Errors
General
-
returns
BackendError::ReadCurrentDirectoryif the current directory could not be read -
returns
BackendError::ProjectDirectoryExistsif a named is passed and a directory with the same name already exists in the current directory -
returns
BackendError::AlreadyAProjectif there’s already a grafbase/schema.graphql in the target -
returns
BackendError::CreateGrafbaseDirectoryif the grafbase directory could not be created -
returns
BackendError::CreateProjectDirectoryif the project directory could not be created -
returns
BackendError::WriteSchemaif the schema file could not be written
Templates
-
returns
BackendError::UnsupportedTemplateURLif a template URL is not supported -
returns
BackendError::StartDownloadRepoArchiveif a template URL is not supported (if the request could not be made) -
returns
BackendError::DownloadRepoArchiveif a repo tar could not be downloaded (on a non 200-299 status) -
returns
BackendError::TemplateNotFoundif no files matching the template path were extracted (excluding extraction errors) -
returns
BackendError::MoveExtractedFilesif the extracted files from the template repository could not be moved -
returns
BackendError::ReadArchiveEntriesif the entries of the template repository archive could not be read -
returns
BackendError::ExtractArchiveEntryif one of the entries of the template repository archive could not be extracted -
returns
BackendError::CleanExtractedFilesif the files extracted from the template repository archive could not be cleaned -
returns
BackendError::StartGetRepositoryInformationif the request to get the information for a repository could not be sent -
returns
BackendError::GetRepositoryInformationif the request to get the information for a repository returned a non 200-299 status -
returns
BackendError::ReadRepositoryInformationif the request to get the information for a repository returned a response that could not be parsed