November 2019
Beginner
804 pages
20h 1m
English
Next up is the createBook method. This is the most complicated one.
First of all, implement all the required validations:
createBook(collectionIdentifier: string): void { if (!collectionIdentifier) { throw new Error("The collection identifier is required to create a new book!"); } console.log("Retrieving the details about the new book to create..."); const bookDetailsResult = this._view.getNewBookDetails(collectionIdentifier); if (bookDetailsResult.error) { console.error("Failed to retrieve the book details: ", bookDetailsResult.error); return; } if (!this._bookCollections.has(collectionIdentifier) || !this._bookCollections.get(collectionIdentifier)) { console.error("Tried to add a book to an unknown ...
Read now
Unlock full access