-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NCBC-165: Provide support for view does not exist scenarios
Currently, when a view doesn't exist an InvalidOperationException bubbles up to the caller. New approach provides CheckExists method of view, which may be called prior to iterating over view or new typed exceptions which provide details of the error. Change-Id: Iedec5543e3eb096815fcbd77a764675d8ed5fded Reviewed-on: http://review.couchbase.org/24068 Reviewed-by: Matt Ingenthron <matt@couchbase.com> Reviewed-by: Saakshi Manocha <saakshi.manocha@globallogic.com> Tested-by: Saakshi Manocha <saakshi.manocha@globallogic.com>
- Loading branch information
1 parent
6eeab0d
commit 66df655
Showing
7 changed files
with
276 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace Couchbase.Exceptions | ||
{ | ||
/// <summary> | ||
/// Standard exception class thrown on when view errors are encountered | ||
/// </summary> | ||
public class ViewException : Exception | ||
{ | ||
public string Error { get; set; } | ||
|
||
public string Reason { get; set; } | ||
|
||
public ViewException(string designDoc, string viewName, string error, string reason) : | ||
base(string.Format("Query failed for view {0} in design document {1}", viewName, designDoc)) | ||
{ | ||
Error = error; | ||
Reason = reason; | ||
} | ||
} | ||
} | ||
|
||
#region [ License information ] | ||
/* ************************************************************ | ||
* | ||
* @author Couchbase <info@couchbase.com> | ||
* @copyright 2013 Couchbase, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* ************************************************************/ | ||
#endregion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace Couchbase.Exceptions | ||
{ | ||
/// <summary> | ||
/// Exception thrown when non-existent view is queried | ||
/// </summary> | ||
public class ViewNotFoundException : ViewException | ||
{ | ||
public ViewNotFoundException(string designDoc, string viewName, string error, string reason) : | ||
base(viewName, designDoc, error, reason) {} | ||
} | ||
} | ||
|
||
#region [ License information ] | ||
/* ************************************************************ | ||
* | ||
* @author Couchbase <info@couchbase.com> | ||
* @copyright 2013 Couchbase, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* ************************************************************/ | ||
#endregion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters