prettify error message for catch-all conflict with existing path segment (#2934)
This commit is contained in:
		
							
								
								
									
										7
									
								
								tree.go
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								tree.go
									
									
									
									
									
								
							@ -349,7 +349,12 @@ func (n *node) insertChild(path string, fullPath string, handlers HandlersChain)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if len(n.path) > 0 && n.path[len(n.path)-1] == '/' {
 | 
							if len(n.path) > 0 && n.path[len(n.path)-1] == '/' {
 | 
				
			||||||
			panic("catch-all conflicts with existing handle for the path segment root in path '" + fullPath + "'")
 | 
								pathSeg := strings.SplitN(n.children[0].path, "/", 2)[0]
 | 
				
			||||||
 | 
								panic("catch-all wildcard '" + path +
 | 
				
			||||||
 | 
									"' in new path '" + fullPath +
 | 
				
			||||||
 | 
									"' conflicts with existing path segment '" + pathSeg +
 | 
				
			||||||
 | 
									"' in existing prefix '" + n.path + pathSeg +
 | 
				
			||||||
 | 
									"'")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// currently fixed width 1 for '/'
 | 
							// currently fixed width 1 for '/'
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user