some
This commit is contained in:
parent
0349ad9a29
commit
11a3767255
@ -289,14 +289,14 @@ func NewRequest(collection LibDataEnum, peerID string, groups []string, caller *
|
|||||||
* @param c ...*tools.HTTPCaller
|
* @param c ...*tools.HTTPCaller
|
||||||
* @return data LibDataShallow
|
* @return data LibDataShallow
|
||||||
*/
|
*/
|
||||||
func (r *Request) Search(filters *dbs.Filters, word string, collection LibDataEnum) (data LibDataShallow) {
|
func (r *Request) Search(filters *dbs.Filters, word string) (data LibDataShallow) {
|
||||||
defer func() { // recover the panic
|
defer func() { // recover the panic
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
tools.UncatchedError = append(tools.UncatchedError, errors.New("Panic recovered in Search : "+fmt.Sprintf("%v", r)))
|
tools.UncatchedError = append(tools.UncatchedError, errors.New("Panic recovered in Search : "+fmt.Sprintf("%v", r)))
|
||||||
data = LibDataShallow{Data: nil, Code: 500, Err: "Panic recovered in LoadAll : " + fmt.Sprintf("%v", r) + " - " + string(debug.Stack())}
|
data = LibDataShallow{Data: nil, Code: 500, Err: "Panic recovered in LoadAll : " + fmt.Sprintf("%v", r) + " - " + string(debug.Stack())}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
d, code, err := models.Model(collection.EnumIndex()).GetAccessor(r.peerID, r.groups, r.caller).Search(filters, word)
|
d, code, err := models.Model(r.collection.EnumIndex()).GetAccessor(r.peerID, r.groups, r.caller).Search(filters, word)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
data = LibDataShallow{Data: d, Code: code, Err: err.Error()}
|
data = LibDataShallow{Data: d, Code: code, Err: err.Error()}
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user