Create a Mattermost Workspace Today Within minutes you can unite your people, tools, and processes. Secure, open source, and made for developers. Try It Now Try It Now Cloud Get up and running immediately in your own private cloud instance. Self-Hosted Host Mattermost on your own infrastructure. func (a * App) CreateChannel (c * request.Context, channel * model.Channel, addMember bool) (*model.Channel, *model.AppError) { channel.DisplayName = strings. TrimSpace (channel.DisplayName) sc , nErr := a. Srv().Store. Channel (). Save (channel, * a. Config ().TeamSettings.MaxChannelsPerTeam) if nErr != nil { var invErr * store.ErrInvalidInput var cErr * store.ErrConflict var ltErr * store.ErrLimitExceeded var appErr * model.AppError switch { case errors. As (nErr, & invErr): switch { case invErr.Entity == "Channel" && invErr.Field == "DeleteAt" : return nil , model. NewAppError ( "CreateChannel" , "store.sql_channel.save.archived_channel.app_error",ni l, "", http.StatusBadRequest) case in vErr.Entity == "Channel" && invErr.Field == "Type" : return nil , model. NewAppError ( "CreateChannel" , "store.sql_channel.save.direct_channel.app_error",nil,"",http. StatusBadRequest) case in vErr.Entity == "Channel" && invErr.Field == "Id" : return nil , model. NewAppError ( "CreateChannel" , "store.sql_channel.save_channel.existing.app_error",nil,"i d="+invErr.Value.(string),http.StatusBadRequest) } c ase errors. As (nErr, & cErr): return sc, model. NewAppError ( "CreateChannel" , store.ChannelExistsError, nil, cErr.Error(), http.StatusBadRequest) case errors. As (nErr, & ltErr): return nil , model. NewAppError ( "CreateChannel" , "store.sql_channel.save_channel.li mit.app_error",nil,ltErr.Error(),http.StatusBadRequest) case errors. As (nErr, & appErr): // in case we haven't converted to plain error. return nil , appErr default : // last fallback in case it doesn't map to an existing app error. return nil , m odel. NewAppError ( "CreateChannel" , "app.channel.create_channel.internal_er ror",nil,nErr.Error(),http.StatusInternalServerError) } }

Overview Guide - Page 13 Overview Guide Page 12 Page 14