MCPcopy Create free account
hub / github.com/VirtualHotBar/NetMount / safeAddStorage

Function safeAddStorage

src/repository/storageRepository.ts:368–391  ·  view source on GitHub ↗
(
  repository: StorageRepository,
  storage: StorageList
)

Source from the content-addressed store, hash-verified

366 * 创建安全的存储添加函数
367 */
368export function safeAddStorage(
369 repository: StorageRepository,
370 storage: StorageList
371): { success: boolean; error?: AppError } {
372 const validationError = validateStorageName(storage.name)
373 if (validationError) {
374 return { success: false, error: validationError }
375 }
376
377 try {
378 repository.add(storage)
379 return { success: true }
380 } catch (error) {
381 if (error instanceof AppError) {
382 return { success: false, error }
383 }
384 return {
385 success: false,
386 error: AppError.api('Failed to add storage', 'ADD_STORAGE_FAILED', {
387 originalError: String(error),
388 }),
389 }
390 }
391}

Callers

nothing calls this directly

Calls 3

addMethod · 0.80
apiMethod · 0.80
validateStorageNameFunction · 0.70

Tested by

no test coverage detected