Rename CommandErrorException to CommandException

This commit is contained in:
Alexey Golub
2019-08-17 16:31:28 +03:00
parent 87688ec29e
commit 2d8b0b4c88
10 changed files with 55 additions and 67 deletions

View File

@@ -40,7 +40,7 @@ namespace CliFx.Demo.Commands
Isbn = CreateRandomIsbn();
if (_libraryService.GetBook(Title) != null)
throw new CommandErrorException(1, "Book already exists.");
throw new CommandException("Book already exists.", 1);
var book = new Book(Title, Author, Published, Isbn);
_libraryService.AddBook(book);

View File

@@ -1,5 +1,4 @@
using System;
using System.Threading.Tasks;
using System.Threading.Tasks;
using CliFx.Attributes;
using CliFx.Demo.Internal;
using CliFx.Demo.Services;
@@ -26,7 +25,7 @@ namespace CliFx.Demo.Commands
var book = _libraryService.GetBook(Title);
if (book == null)
throw new CommandErrorException(1, "Book not found.");
throw new CommandException("Book not found.", 1);
console.RenderBook(book);

View File

@@ -1,5 +1,4 @@
using System;
using System.Threading.Tasks;
using System.Threading.Tasks;
using CliFx.Attributes;
using CliFx.Demo.Internal;
using CliFx.Demo.Services;

View File

@@ -1,5 +1,4 @@
using System;
using System.Threading.Tasks;
using System.Threading.Tasks;
using CliFx.Attributes;
using CliFx.Demo.Services;
using CliFx.Exceptions;
@@ -25,7 +24,7 @@ namespace CliFx.Demo.Commands
var book = _libraryService.GetBook(Title);
if (book == null)
throw new CommandErrorException(1, "Book not found.");
throw new CommandException("Book not found.", 1);
_libraryService.RemoveBook(book);

View File

@@ -1,5 +1,4 @@
using System;
using System.IO;
using System.IO;
using System.Linq;
using CliFx.Demo.Models;
using Newtonsoft.Json;